public function locate($entity, Request $request, $template = null)
    {
        if (!$template) {
            $template = 'TenelevenGeolocatorBundle::results.html.twig';
        }

        $provider = $this->getLocationProvider($entity);
        $form = $this->get('form.factory')->createNamed('', $provider->getFilterFormType(), null, array(
            'method' => 'GET', 
            'csrf_protection' => false,
            'allow_extra_fields' => true,
        ));
        
        foreach ($request->query->all() as $key => $value) {
            if ($form->has($key)) {
                continue;
            }
            
            $form->add($key, HiddenType::class, [
                'data' => $value,
            ]);
        }

        try {
            $form->handleRequest($request);
        } catch (QuotaExceeded $e) {
            $this->get('logger')->error($e->getMessage());
            $this->get('session')->getFlashBag()->add('error', 'Sorry, this locator has exceeded the quota for location look-ups. Please try again at a later time.');
        }

        if (!$form->isValid()) {
            return $this->render($template, array(
                'map' => $map = $this->getMap(),
                'form' => $form->createView()
            ));
        }

        $result = $provider->findLocations($form);
        $map = $this->buildMap($template, $result);

        return $this->render($template, array(
            'form' => $form->createView(),
            'result' => $result,
            'map' => $map
        ));
    }