/**
  * Create a new service group
  */
 public function postAction()
 {
     // Create model
     $data = $this->_helper->requestData(true);
     $sg = new SupervisionGroupModel($data);
     $org = \App::getOrgUserLogged();
     $sg->setCustomerId($org->getId());
     // Check permissions
     $this->_helper->allowed('create', $sg);
     $sg = SupervisionGroupService::getInstance()->create($sg);
     // Response with the id
     $this->view->data = $sg->getId();
 }
 /**
  * @param Model\SupervisionGroupModel $suprvGroup
  */
 protected function _update($suprvGroup)
 {
     $service = $this->getEricssonService();
     $methodName = self::METHOD_NAME_UPDATE;
     try {
         // Prepare ID
         $wgId = $this->_generateWorkgroupId($suprvGroup->getId());
         // Prepare proto
         $proto = $this->_createProto($methodName, $service);
         $mappedData = $this->_mapModelToProtoModel($suprvGroup->exportData());
         $proto->parse(array('workgroup' => $mappedData), new \DrSlump\Protobuf\Codec\PhpArray());
         $proto->setId($wgId);
         $response = $this->_sendRequest($methodName, array('protoMessage' => $proto), $service);
     } catch (Exception $e) {
         \App::log()->CRIT($e);
         throw $e;
     }
     // Response ok?
     $isOk = $this->_checkResponseResult($response);
     if ($isOk) {
         $suprvGroup->setId($suprvGroup->getName());
         return $suprvGroup->getId();
     } else {
         return $isOk;
     }
 }