protected function renderWithParameters(Route $route, $name = null, array $parameter = array())
    {
        $request = $this->buildRequest($route, $name, $parameter);

        $response = $this->kernel->handle($request);
        $content = $response->getContent();
        $this->kernel->terminate($request, $response);
        $this->kernel->shutdown();

        if (null !== $name) {
            $filename = $this->router->generate($name, $parameter);
        } else {
            $filename = $route->getPath();
        }

        $this->writer->write($filename, $content);
    }