@Override
 protected synchronized void removeProvider(Provider<Rule> provider) {
   Collection<Rule> rules = provider.getAll();
   for (Iterator<Rule> it = rules.iterator(); it.hasNext(); ) {
     Rule rule = it.next();
     String uid = rule.getUID();
     if (ruleEngine.removeRule(uid)) {
       postEvent(RuleEventFactory.createRuleRemovedEvent(rule, SOURCE));
     }
     if (disabledRulesStorage != null) {
       disabledRulesStorage.remove(uid);
     }
   }
   if (provider instanceof ManagedRuleProvider) {
     hasManagedRuleProvider = false;
   }
   super.removeProvider(provider);
 }
 @Override
 protected synchronized void addProvider(Provider<Rule> provider) {
   if (provider instanceof ManagedRuleProvider) {
     hasManagedRuleProvider = true;
   }
   Collection<Rule> rules = provider.getAll();
   for (Iterator<Rule> it = rules.iterator(); it.hasNext(); ) {
     Rule rule = it.next();
     try {
       String rUID = rule.getUID();
       if (rUID != null
           && disabledRulesStorage != null
           && disabledRulesStorage.get(rUID) != null) {
         ruleEngine.addRule(rule, false);
       } else {
         ruleEngine.addRule(rule, true);
       }
     } catch (Exception e) {
       logger.error(
           "Can't add rule: " + rule.getUID() + " into rule engine from provider " + provider, e);
     }
   }
   super.addProvider(provider);
 }