public function onKernelRequest(GetResponseEvent $event)
    {
        $request = $event->getRequest();
        $this->requestUri = $request->getRequestUri();

        try {
            $this->session = $request->getSession();
        } catch (\Exception $e) {
            $this->logger->error("Unable to access session: {$e->getMessage()}");
        }
        if ($this->session) {
            try {
                // If context exists in the session, use this information
                if ($this->session->has(static::SESSION_KEY)) {
                    $this->context = $this->session->get(static::SESSION_KEY);
                }
            } catch (\Exception $e) {
                $this->logger->error("Unable to get context from session: {$e->getMessage()}");
            }
        }

        $form = $this->getContextSelectorForm();
        if (!$form) {
            return;
        }
        $form->handleRequest($request);
        // Check if form is submitted and redirect to same url in GET
        if ($form->isSubmitted() && $form->isValid()) {
            $this->setContext($form->getData());
            $redirectResponse = new RedirectResponse($this->requestUri);
            $event->setResponse($redirectResponse);
        }
    }