private List <Work_Rule__c> initiateRulesWithRelvanceGroupList( Dictionary <string, List <Work_Rule__c> > i_RulesByDevName, ServiceAppointment i_Service) { List <Work_Rule__c> rulesFilteredByRelevanceGroup = new List <Work_Rule__c>(); foreach (List <Work_Rule__c> rules in i_RulesByDevName.Values) { foreach (Work_Rule__c rule in rules.Where(rule => rule.Object_Group_Field__c == null || ServiceAppointmentUtils.getBooleanField(i_Service, rule.Object_Group_Field__c))) { rulesFilteredByRelevanceGroup.Add(rule); } } return(rulesFilteredByRelevanceGroup); }