public function before(Request $request)
    {
        // Start the 'stopwatch' for the profiler.
        $this->app['stopwatch']->start('bolt.frontend.before');

        // If there are no users in the users table, or the table doesn't exist.
        // Repair the DB, and let's add a new user.
        if (!$this->hasUsers()) {
            $this->flashes()->info(Trans::__('general.phrase.users-none-create-first'));

            return $this->redirectToRoute('userfirst');
        }

        // If we are in maintenance mode and current user is not logged in, show maintenance notice.
        if ($this->getOption('general/maintenance_mode') && !$this->isAllowed('maintenance-mode')) {
            $twig = $this->app['twig'];
            $template = $this->templateChooser()->maintenance();

            $html = $twig->resolveTemplate($template)->render([]);
            $response = new TemplateResponse($template, [], $html, Response::HTTP_SERVICE_UNAVAILABLE);

            return $response;
        }

        // Stop the 'stopwatch' for the profiler.
        $this->app['stopwatch']->stop('bolt.frontend.before');

        return null;
    }