private function mapQueryToActionParameters(RouteEndpoint $route, RequestInterface $request) : array
    {
        $reflection = new ReflectionClass($route->getFullyQualifiedName());
        $method = $reflection->getMethod($route->getAction(true));
        $query = $request->getQuery();

        $mapper = [];
        foreach ($method->getParameters() as $parameter) {
            $defaultValue = null;
            if ($parameter->isDefaultValueAvailable()) {
                $defaultValue = $parameter->getDefaultValue();
            }

            $value = $query->get($parameter->getName(), $defaultValue);

            // We are missing a required parameter, so this is a bad request
            if ($value === null && !$parameter->allowsNull()) {
                throw HttpException::badRequest();
            }

            $mapper[$parameter->getName()] = $value;
        }

        return $mapper;
    }