protected function extractViewParameters(Request $request, array $exclude = [])
    {
        $parameters = [];

        foreach ($request->attributes as $key => $value) {
            if (strpos($key, '_') !== 0 && !in_array($key, $exclude)) {
                $parameters[$key] = $value;
            }
        }

        return $parameters;
    }