code: public function storePermissions($params = array()) {
  
  
          //2. Saniitize the data
          $authorityAreaTitle = $this->input->getString("area-title");
          $authorityAreaURI = $this->input->getString("area-uri");
          $authorityAreaAction = $this->input->getString("area-action");
          $authorityAreaPermission = $this->input->getString("area-permission");
          $authorityId = $this->input->getInt("area-authority");
  
          //3. Synchronize and bind to table object
          $table = $this->load->table("?authority_permissions");
  
          $aData = array(
              "authority_id" => $authorityId,
              "permission_area_uri" => strtolower($authorityAreaURI),
              "permission" => strtolower($authorityAreaPermission),
              "permission_type" => strtolower($authorityAreaAction),
              "permission_title" => $authorityAreaTitle
          );
  
          //All fields required;
          foreach ($aData as $k => $item) {
              if (empty($item)) {
                  $this->setError(_t("Please complete all permission fields; Provide a title and uri defining the area, a permission type and value"));
                  return false;
              }
          }
  
          if (!$table->bindData($aData)) {
              throw new \Platform\Exception($table->getError());
              return false;
          }
  
          //@TODO: Check that we are not denying permission to an authority whose parent is granted the permission!!!
          //Check the Permission Area URI, make sure its not a route id,
          //We need exact URI paths, Throw an error if it does not make sense
          if ($table->isNewRow()) {
              
          }
  
          //5. Save the table modifications
          if (!$table->save()) {
              return false;
          }
  
          return true;
      }
docs: Save authority group permissions
  @param array $params
  @return boolean True on success
  @throws \Platform\Exception on failure