[BUGFIX] Don't remove referenced entities
This change adds a check to the removal of dereferenced
entities in the AbstractBackend. If the entity was visited
during the peristence, another reference to the entity was found and it will not be removed.