public function fetchAction(Request $request)
    {
        $reference = strtoupper($request->query->get('reference', null));
        $remote = (bool)$request->query->get('remote', 1);

        if (0 < strlen($reference) && $remote) {
            $remoteEndPoints = $this->container->getParameter('ekyna_setting.helper_remotes');
            foreach ($remoteEndPoints as $remoteEndPoint) {
                // remote=0 prevent infinite loop/recursion
                $url = $remoteEndPoint . '?reference=' . $reference . '&remote=0';
                $headers = $request->headers->all();
                if (null !== $response = $this->getRemoteResponse($url, $headers)) {
                    return $response;
                }
            }
        }

        $ttl = 7 * 24 * 3600;
        $response = new Response();
        $response
            ->setPublic()
            ->headers->add(['Content-Type' => 'application/xml; charset=utf-8'])
        ;

        if (0 < strlen($reference)) {
            $repository = $this->getDoctrine()->getRepository('EkynaSettingBundle:Helper');
            if (null !== $helper = $repository->findOneBy(['reference' => $reference])) {
                $response->setLastModified($helper->getUpdatedAt());
                if ($response->isNotModified($request)) {
                    return $response;
                }
                $response->setContent($this->renderView('EkynaSettingBundle:Helper:show.xml.twig', [
                    'helper' => $helper,
                ]));
                return $this->configureSharedCache($response, [$helper->getEntityTag()], $ttl);
            }
        }

        $expires = new \DateTime();
        $expires->modify('+7 days');
        return $response
            ->setMaxAge($ttl)
            ->setExpires($expires)
            ->setContent($this->renderView('EkynaSettingBundle:Helper:show.xml.twig'))
        ;
    }