/**
  * Instead of saving from post, we are saving from the API data.
  * @see attemptToSaveModelFromPost
  */
 protected function attemptToSaveModelFromData($model, $data, $redirectUrlParams = null, $redirect = true)
 {
     assert('is_array($data)');
     assert('$redirectUrlParams == null || is_array($redirectUrlParams) || is_string($redirectUrlParams)');
     $savedSucessfully = false;
     $modelToStringValue = null;
     if (isset($data)) {
         $this->preAttemptToSaveModelFromDataHook($model, $data);
         $controllerUtil = new ZurmoControllerUtil();
         $model = $controllerUtil->saveModelFromSanitizedData($data, $model, $savedSucessfully, $modelToStringValue, false);
     }
     if ($savedSucessfully && $redirect) {
         $this->actionAfterSuccessfulModelSave($model, $modelToStringValue, $redirectUrlParams);
     }
     return $model;
 }