/**
  * Function to validate if rule label already exists
  *
  * @param array $fields
  * @return array|bool
  * @access static
  */
 static function validateRuleLabelExists($fields)
 {
     /*
      * if id not empty, edit mode. Check if changed before check if exists
      */
     if (!empty($fields['id']) && $fields['id'] != 'RuleId') {
         /*
          * check if values have changed against database label
          */
         $currentLabel = CRM_Civirules_BAO_Rule::getRuleLabelWithId($fields['id']);
         if ($fields['rule_label'] != $currentLabel && CRM_Civirules_BAO_Rule::labelExists($fields['rule_label']) == TRUE) {
             $errors['rule_label'] = ts('There is already a rule with this name');
             return $errors;
         }
     } else {
         if (CRM_Civirules_BAO_Rule::labelExists($fields['rule_label']) == TRUE) {
             $errors['rule_label'] = ts('There is already a rule with this name');
             return $errors;
         }
     }
     return TRUE;
 }