@Override
 public synchronized void setEnabled(String uid, boolean isEnabled) {
   ruleEngine.setRuleEnabled(uid, isEnabled);
   if (disabledRulesStorage != null)
     if (isEnabled) {
       disabledRulesStorage.remove(uid);
     } else {
       disabledRulesStorage.put(uid, isEnabled);
     }
 }
 protected void setDisabledRuleStorage(Storage<Boolean> disabledRulesStorage) {
   this.disabledRulesStorage = disabledRulesStorage;
   for (Rule rule : ruleEngine.getRules()) {
     String uid = rule.getUID();
     if (ruleEngine.getRuleStatus(uid).equals(RuleStatus.DISABLED)) {
       disabledRulesStorage.put(uid, false);
     } else {
       disabledRulesStorage.remove(uid);
     }
   }
 }
 @Override
 public synchronized Rule remove(String key) {
   Rule rule = super.remove(key);
   if (ruleEngine.removeRule(key)) {
     postEvent(RuleEventFactory.createRuleRemovedEvent(rule, SOURCE));
   }
   if (disabledRulesStorage != null) {
     disabledRulesStorage.remove(key);
   }
   return rule;
 }
 @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);
 }