public function validationResponse(\Psc\Form\ValidatorExceptionList $list, $format = ServiceResponse::JSON, MetadataGenerator $metadataGenerator = NULL) {
    if ($format === ServiceResponse::JSON) {
      $body = (object) array('errors'=>array());
    
      foreach ($list->getExceptions() as $validatorException) {
        $body->errors[$validatorException->field] = $validatorException->getMessage();
      }
    
      return HTTPResponseException::BadRequest(json_encode($body), NULL, array('Content-Type'=>'application/json'));
    } else {
      $metadataGenerator = $metadataGenerator ?: new MetadataGenerator();
      
      return HTTPException::BadRequest(
          $list->getMessage(),
          $list,
          array_merge(
            array('Content-Type'=>'text/html'),
            $metadataGenerator->validationList($list)->toHeaders()
          )
      );
    }
  }