public function getIdentifierByObject($object)
    {
        if ($this->hasObject($object)) {
            return $this->objectMap[$object];
        }

        $idPropertyNames = $this->reflectionService->getPropertyNamesByTag(get_class($object), 'id');
        if (count($idPropertyNames) === 1) {
            $idPropertyName = $idPropertyNames[0];
            return ObjectAccess::getProperty($object, $idPropertyName, true);
        } elseif (property_exists($object, 'Persistence_Object_Identifier')) {
            return ObjectAccess::getProperty($object, 'Persistence_Object_Identifier', true);
        }

        return null;
    }