public function assignAggregatorAction()
 {
     if (!$this->getRequest()->isPost()) {
         throw new AppEx\UnexpectedException("Resquest must be POST");
     }
     $data = $this->_helper->requestData();
     $cgId = $data['cgId'];
     if (!isset($cgId) && !strlen($cgId)) {
         throw new AppEx\InvalidArgumentException('You must indicate a commercial group id');
     }
     $commercialGroup = $this->_cgSrv->load($cgId);
     // Check permissions
     $this->_helper->allowed('assign_aggregator', $commercialGroup);
     //GLOBALPORTAL-34278
     //TODO: very hacky approach don't like it
     $commercialGroupData = $commercialGroup->exportData();
     $commercialGroupData = $this->_cgSrv->cleanDataForUpdate($commercialGroupData);
     $commercialGroupData = $this->_cgSrv->clearDataForUpdate($commercialGroupData);
     $commercialGroup->importData($commercialGroupData);
     if (empty($commercialGroup)) {
         throw new NotFoundException("Commercial Group {$cgId} not found", 404);
     }
     $aggregatorId = $data['aggregatorId'];
     if (!isset($aggregatorId) && !strlen($aggregatorId)) {
         throw new AppEx\InvalidArgumentException('You must indicate a aggregator id');
     }
     $aggregator = Application\Service\OrgService::getInstance()->load($aggregatorId);
     if (empty($aggregator)) {
         throw new Exceptions\NotFoundException("Aggregator given not found");
     }
     $result = $this->_cgSrv->assignAggregator($commercialGroup, $aggregatorId);
     // Response with the organization id
     $this->view->data = $result;
 }