/**
     * @return Pap_Db_CommissionTypeAttribute
     */
    private function getCommTypeAttr(Gpf_Rpc_Form $form, $attributeName) {
        if (!$form->existsField($attributeName)) {
            return false;
        }
        $commTypeAttr = new Pap_Db_CommissionTypeAttribute();
        $commTypeAttr->setCommissionTypeId($form->getFieldValue("Id"));
        $commTypeAttr->setName($attributeName);

        try {
            $commTypeAttr->loadFromData(array(Pap_Db_Table_CommissionTypeAttributes::COMMISSION_TYPE_ID,
            Pap_Db_Table_CommissionTypeAttributes::NAME));
        } catch (Gpf_Exception $e) {
        }
        $commTypeAttr->setValue($form->getFieldValue($attributeName));
        return $commTypeAttr;
    }
 /**
  * Set value to attribute. If attribute doesn't exist, create new.
  *
  * @param $commissionTypeId
  * @param $name
  *
  * @return unknown_type
  */
 public function setCommissionTypeAttributeValue($commissionTypeId, $name, $value) {
     try {
         $commTypeAttr = $this->getCommissionTypeAttribute($commissionTypeId, $name);
     } catch (Gpf_DbEngine_NoRowException $e) {
         $commTypeAttr = new Pap_Db_CommissionTypeAttribute();
         $commTypeAttr->setCommissionTypeId($commissionTypeId);
         $commTypeAttr->setName($name);
         $commTypeAttr->insert();
     }
     $commTypeAttr->setValue($value);
     $commTypeAttr->update(array(self::VALUE));
 }