/**
  * API Method inserts a new Veiculo record and render response as JSON
  */
 public function Create()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $veiculo = new Veiculo($this->Phreezer);
         // TODO: any fields that should not be inserted by the user should be commented out
         $veiculo->Id = $this->SafeGetVal($json, 'id');
         $veiculo->Placa = $this->SafeGetVal($json, 'placa');
         $veiculo->Marca = $this->SafeGetVal($json, 'marca');
         $veiculo->Modelo = $this->SafeGetVal($json, 'modelo');
         $veiculo->Doc = $this->SafeGetVal($json, 'doc');
         $veiculo->Validate();
         $errors = $veiculo->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             // since the primary key is not auto-increment we must force the insert here
             $veiculo->Save(true);
             $this->RenderJSON($veiculo, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }