/**
  * @param $response Psr\Http\Message\ResponseInterface 
  * @param mixed $content Content to return as response body
  *
  * @return Psr\Http\Message\ResponseInterface
  */
 protected function withBody($response, $content = null)
 {
     $body = $response->getBody();
     if ($content == null) {
         $content = $this->template->toString();
     }
     $body->write($content);
     $response = $response->withBody($body);
     return $response;
 }