private function executeAction(Request $request, Response $response)
    {
        $route = $this->getRouter()->getRoute($request);

        if (!method_exists($route->getController(), $route->getAction())) {
            if ('prod' === $this->configuration['framework']['env']) {
                return $response
                    ->setContent($this->getRouter()->getConfiguration()->getNotFoundMsg() ?? 'Not found.')
                    ->setStatusCode(Response::HTTP_NOT_FOUND);
            }

            throw new ActionNotFoundException($route->getAction() . ' for ' . $route->getController() . ' not found.');
        }

        $errorController = $this->getRouter()->getConfiguration()->getControllerNamespace() . 'ErrorController';

        if (1 === preg_match('(Partial|Passive)', $route->getAction()) || $errorController === $route->getController()) {
            if ('prod' === $this->configuration['framework']['env']) {
                return $response
                    ->setContent('Forbidden.')
                    ->setStatusCode(Response::HTTP_FORBIDDEN);
            }

            throw new ActionForbiddenException('Partial, passive and error actions cannot be requested by user.');
        }

        $controllerName = $route->getController();
        $controller = new $controllerName($this->drivers, $request, $response);

        return $controller->{$route->getAction()}(...$route->getActionParams());
    }