public function createResponseFromPage(
        PageInterface $page = null,
        $path = ''
    ) {
        if (
            !($page instanceof PageInterface) ||
            $page->getType() !== ElcodiPageTypes::TYPE_REGULAR
        ) {
            throw new NotFoundHttpException('Page not found');
        }

        $request = $this
            ->requestStack
            ->getCurrentRequest();

        /**
         * Request not found because this controller is not running under
         * Request scope.
         */
        if (!($request instanceof Request)) {
            throw new RuntimeException('Request object not found');
        }

        /**
         * We must check that the product slug is right. Otherwise we must
         * return a Redirection 301 to the right url.
         */
        if (
            $page->getPath() &&
            $path !== $page->getPath()
        ) {
            return new RedirectResponse(
                $this
                    ->urlGenerator
                    ->generate($this->pageRenderRoute, [
                        'id' => $page->getId(),
                        'path' => $page->getPath(),
                    ]),
                301
            );
        }

        $response = $this->createResponseInstance($page);

        if (!$response->isNotModified($request)) {
            $response->setContent($this->renderPage($page));
            $response->headers->set('Content-Type', 'text/html');
        }

        return $response;
    }