/**
  * API Method inserts a new Configuracao 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');
         }
         $configuracao = new Configuracao($this->Phreezer);
         // TODO: any fields that should not be inserted by the user should be commented out
         // this is an auto-increment.  uncomment if updating is allowed
         // $configuracao->IdConfiguracao = $this->SafeGetVal($json, 'idConfiguracao');
         $configuracao->NomeInstituicao = $this->SafeGetVal($json, 'nomeInstituicao');
         $configuracao->ImagemLogo = $this->SafeGetVal($json, 'imagemLogo');
         $configuracao->Cnpj = $this->SafeGetVal($json, 'cnpj');
         $configuracao->Telefone = $this->SafeGetVal($json, 'telefone');
         $configuracao->Validate();
         $errors = $configuracao->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Verifique erros no preenchimento do formulário', $errors);
         } else {
             $configuracao->Save();
             $this->RenderJSON($configuracao, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }