public function createProxyForNode($fromDocument, NodeInterface $targetNode, $options = [])
    {
        // if node is already registered then just return the registered document
        $locale = $this->registry->getOriginalLocaleForDocument($fromDocument);
        if ($this->registry->hasNode($targetNode, $locale)) {
            $document = $this->registry->getDocumentForNode($targetNode, $locale);

            // If the parent is not loaded in the correct locale, reload it in the correct locale.
            if ($this->registry->getOriginalLocaleForDocument($document) !== $locale) {
                $hydrateEvent = new HydrateEvent($targetNode, $locale);
                $hydrateEvent->setDocument($document);
                $this->dispatcher->dispatch(Events::HYDRATE, $hydrateEvent);
            }

            return $document;
        }

        $initializer = function(LazyLoadingInterface $document, $method, array $parameters, &$initializer) use (
            $targetNode,
            $options,
            $locale
        ) {
            $hydrateEvent = new HydrateEvent($targetNode, $locale, $options);
            $hydrateEvent->setDocument($document);
            $this->dispatcher->dispatch(Events::HYDRATE, $hydrateEvent);

            $initializer = null;
        };

        $targetMetadata = $this->metadataFactory->getMetadataForPhpcrNode($targetNode);
        $proxy = $this->proxyFactory->createProxy($targetMetadata->getClass(), $initializer);
        $locale = $this->registry->getOriginalLocaleForDocument($fromDocument);
        $this->registry->registerDocument($proxy, $targetNode, $locale);

        return $proxy;
    }