/**
  * Update an user identified by its Id
  */
 public function putAction()
 {
     $commercialGroup = $this->_getCommercialGroup();
     // Check permissions
     $this->_helper->allowed('update', $commercialGroup);
     // Check data
     $data = $this->_helper->requestData(true, false);
     if (empty($data)) {
         return;
     }
     if (isset($data['endCustomer']) && $data['endCustomer'] === '-') {
         $data['endCustomer'] = "";
     }
     $data = $this->_mapToModel($data);
     // CleaN
     $data = $this->_cgSrv->cleanDataForUpdate($data);
     // CleaR
     $data = $this->_cgSrv->clearDataForUpdate($data);
     $data = $this->_helper->filter($data)->blacklist(array('customerId'));
     $commercialGroup = $commercialGroup->importData($data);
     try {
         $this->_cgSrv->update($commercialGroup);
     } catch (\Application\Model\Mapper\Exception\EricssonException $e) {
         if ($e->getCode() == 40133) {
             \App::log()->err($e->getMessage());
             throw new InvalidArgumentException("Invalid parameter value: billingAccountId");
         } else {
             throw $e;
         }
     } catch (\Application\Exceptions\ValidateException $e) {
         throw $this->_mapException($e);
     }
     $this->getResponse()->setHttpResponseCode(204);
     $this->_helper->viewRenderer->setNoRender(TRUE);
 }
 /**
  * Update an user identified by its Id
  */
 public function putAction()
 {
     $id = $this->_getParam('id', null);
     if (!isset($id) && !strlen($id)) {
         throw new InvalidArgumentException('You must indicate a commercial group id');
     }
     $commercialGroup = $this->_cgSrv->load($id);
     // Check permissions
     $this->_helper->allowed('update', $commercialGroup);
     if (empty($commercialGroup)) {
         throw new NotFoundException("Commercial Group {$id} not found", 404);
     }
     $data = $this->_helper->requestData();
     $data = $this->_cgSrv->cleanDataForUpdate($data);
     $data = $this->_cgSrv->clearDataForUpdate($data);
     $commercialGroup->importData($data);
     $result = $this->_cgSrv->update($commercialGroup);
     // Response with the organization id
     $this->view->data = $result;
 }