/**
  * Function to add or update rule condition
  * 
  * @param array $params 
  * @return array $result
  * @access public
  * @throws Exception when params is empty
  * @static
  */
 public static function add($params)
 {
     $result = array();
     if (empty($params)) {
         throw new Exception('Params can not be empty when adding or updating a civirule rule condition');
     }
     $ruleCondition = new CRM_Civirules_BAO_RuleCondition();
     $fields = self::fields();
     foreach ($params as $key => $value) {
         if (isset($fields[$key])) {
             $ruleCondition->{$key} = $value;
         }
     }
     $ruleCondition->save();
     self::storeValues($ruleCondition, $result);
     return $result;
 }