public void SetRule(string jobId, RuleConfiguration rule) { var job = configurationManager.ClientConfiguration.Jobs.FirstOrDefault(x => x.Id == jobId); if (job == null) { throw new JobNotFoundException(jobId); } var oldRule = job.Rules.FirstOrDefault(x => x.Id == rule.Id); if (oldRule == null) { configurationManager.AddRule(jobId, rule); } else { configurationManager.DeleteRule(jobId, oldRule.Id); configurationManager.AddRule(jobId, rule); } }