/**
  * @param DataIndexerElement $element
  * @param Request $request
  * @return RedirectResponse
  */
 private function getRedirectResponse(DataIndexerElement $element, Request $request)
 {
     if ($request->query->get('redirect_uri')) {
         $uri = $request->query->get('redirect_uri');
     } else {
         $uri = $this->router->generate($element->getRoute(), $element->getRouteParameters());
     }
     return new RedirectResponse($uri);
 }