public static RuleSetDef GetRuleSetByName(RuleApplicationDef ruleAppDef, string ruleSetName)
        {
            RuleSetDef ruleSetDef = null;

            // first look in Entities for the RuleSet
            foreach (EntityDef entityDef in ruleAppDef.Entities)
            {
                ruleSetDef = GetRuleSetByName(entityDef, ruleSetName);
                if (ruleSetDef != null)
                {
                    return(ruleSetDef);
                }
            }
            // if we haven't found it, look in the independent rulesets
            foreach (RuleSetDef indRuleSetDef in ruleAppDef.GetAllRuleSets())
            {
                if (indRuleSetDef.Name == ruleSetName)
                {
                    return(indRuleSetDef);
                }
            }

            return(ruleSetDef);
        }