protected function configurePermalinkForNewLanguage($content)
    {
        if (null === $this->languageManager || null === $this->container) {
            return $content;
        }

        $urlManager = $this->container->get('red_kite_cms.url_manager');
        $languageName =  $this->languageManager->get()->getLanguageName();

        return preg_replace_callback('/(\<a[^\>]+href[="\'\s]+)([^"\'\s]+)?([^\>]+\>)/s', function ($matches) use ($urlManager, $languageName) {
            $url = $urlManager
                ->fromUrl($matches[2])
                ->getInternalUrl();

            return (null !== $url) ? $matches[1] . $languageName . '-' . $url . $matches[3] : $matches[1] . $matches[2] . $matches[3];
        }, $content);
    }