/** * Populates and saves model attributes * @param $_POST $post $_POST data * @param CiiSettingsModel $model The model we want to populate * @return array The saved model attributes or an error message */ private function loadData($post, &$model) { $model->populate($_POST, true); if ($model->save()) { return $this->getModelAttributes($model); } return $this->returnError(400, NULL, $model->getErrors()); }