public function handlePersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!($document instanceof CustomUrlBehavior)) {
            return;
        }

        $webspaceKey = $this->inspector->getWebspace($document);
        $domain = $this->generator->generate($document->getBaseDomain(), $document->getDomainParts());
        $locale = $this->webspaceManager->findWebspaceByKey($webspaceKey)->getLocalization(
            $document->getTargetLocale()
        );
        $route = $this->createRoute(
            $domain,
            $document,
            $locale,
            $event->getLocale(),
            $this->getRoutesPath($webspaceKey)
        );

        $this->updateOldReferrers($document, $route, $event->getLocale());
    }