private function executeUpdates(ClassMetadata $class, array $options = array())
    {
        $className = $class->name;
        $persister = $this->getXmlEntityPersister($className);

        $hasPreUpdateLifecycleCallbacks = isset($class->lifecycleCallbacks[Events::preUpdate]);
        $hasPreUpdateListeners = $this->evm->hasListeners(Events::preUpdate);
        $hasPostUpdateLifecycleCallbacks = isset($class->lifecycleCallbacks[Events::postUpdate]);
        $hasPostUpdateListeners = $this->evm->hasListeners(Events::postUpdate);

        foreach ($this->entityUpdates as $oid => $xmlEntity) {
            if (get_class($xmlEntity) == $className || $xmlEntity  instanceof Proxy && $xmlEntity instanceof $className) {
//                if ( ! $class->isEmbeddedDocument) {
                if ($hasPreUpdateLifecycleCallbacks) {
                    $class->invokeLifecycleCallbacks(Events::preUpdate, $xmlEntity);
    //                        $this->recomputeSingleDocumentChangeSet($class, $xmlEntity);
                }

                if ($hasPreUpdateListeners) {
                    $this->evm->dispatchEvent(Events::preUpdate, new Event\PreUpdateEventArgs(
                        $xmlEntity, $this->xem, $this->entityChangeSets[$oid])
                    );
                }

                $persister->update($xmlEntity);
                unset($this->entityUpdates[$oid]);

                if ($hasPostUpdateLifecycleCallbacks) {
                    $class->invokeLifecycleCallbacks(Events::postUpdate, $xmlEntity);
                }
                if ($hasPostUpdateListeners) {
                    $this->evm->dispatchEvent(Events::postUpdate, new Event\LifecycleEventArgs($xmlEntity, $this->xem));
                }
//                    $this->cascadePostUpdateAndPostPersist($class, $xmlEntity);
            }
        }
    }