/**
  * Serialize data and create response
  *
  * @param Application $app
  * @param mixed       $data
  * @param string      $format
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function createResponse(Application $app, $data, $format = 'json')
 {
     $content = $app->serialize(array('result' => true, 'data' => $data), $format);
     $guesser = new ExtensionMimeTypeGuesser();
     $type = $guesser->guess('.' . $format);
     if (!$type) {
         $type = 'text/plain';
     }
     return new Response($content, 200, array('Content-Type' => $type, 'Cache-Control' => 's-maxage=3600, public'));
 }