protected function redirect($environment, $copiedModelId)
    {
        // Build a clean url to remove the copy related arguments instead of using the AddToUrlEvent.
        $urlBuilder = new UrlBuilder();
        $urlBuilder
            ->setPath('contao')
            ->setQueryParameter('do', $environment->getInputProvider()->getParameter('do'))
            ->setQueryParameter('table', $copiedModelId->getDataProviderName())
            ->setQueryParameter('act', 'edit')
            ->setQueryParameter('id', $copiedModelId->getSerialized())
            ->setQueryParameter('pid', $environment->getInputProvider()->getParameter('pid'));

        $securityUrlBuilder = System::getContainer()->get('cca.dc-general.security-url-builder-factory');

        $redirectEvent = new RedirectEvent($securityUrlBuilder->create($urlBuilder->getUrl())->getUrl());
        $environment->getEventDispatcher()->dispatch(ContaoEvents::CONTROLLER_REDIRECT, $redirectEvent);
    }