private function removeFromIdentityMap($object)
    {
        $class = $this->manager->getClassMetadata(get_class($object));
        $id = $class->getSingleIdentifier($object);

        if (empty($id)) {
            throw new InvalidIdentifierException('Documents must have an identifier in order to be added to the identity map.');
        }

        unset($this->identityMap[$class->name][$id]);
    }