public function createTemplateResponse($response)
    {
        $page = $this->getPage();

        $view = new View();
        $view->setContext($this);
        $view->setTemplatePath($this->getTemplatePath());
        $configuration = ConfigurationManager::getConfiguration();
        $view->assignMultiple(
            [
                'page'          => $page,
                'meta'          => $page ? $page->getMeta() : [],
                'content'       => $response->getBody(),
                'response'      => $response,
                'resourcePath'  => $configuration->getResourceDirectoryUri(),
                'configuration' => $configuration,
            ]
        );

        return new Response(
            $view->render(),
            $response->getStatusCode(),
            $response->getStatusText()
        );
    }