private function cascadePreLoad(ClassMetadata $class, $document, $data)
    {
        $hasPreLoadListeners = $this->evm->hasListeners(Events::preLoad);

        foreach ($class->fieldMappings as $mapping) {
            if (isset($mapping['embedded'])) {
                $value = $class->reflFields[$mapping['fieldName']]->getValue($document);
                if ($value === null) {
                    continue;
                }
                if ($mapping['type'] === 'one') {
                    $value = array($value);
                }
                foreach ($value as $entry) {
                    $entryClass = $this->dm->getClassMetadata(get_class($entry));
                    if ( ! empty($entryClass->lifecycleCallbacks[Events::preLoad])) {
                        $args = array(&$data);
                        $entryClass->invokeLifecycleCallbacks(Events::preLoad, $entry, $args);
                    }
                    if ($hasPreLoadListeners) {
                        $this->evm->dispatchEvent(Events::preLoad, new PreLoadEventArgs($entry, $this->dm, $data[$mapping['name']]));
                    }
                    $this->cascadePreLoad($entryClass, $entry, $data[$mapping['name']]);
                }
            }
        }
    }