private static void TransformTypeRulesToPathRules(ElementNode node, Dictionary <string, string> typeRules, List <AnonymizerRule> rules, HashSet <string> rulePaths) { if (node.IsContainedNode() || node.IsEntryNode()) { return; } string path = node.GetFhirPath(); if (rulePaths.Contains(path)) { return; } if (typeRules.ContainsKey(node.InstanceType)) { var rule = new AnonymizerRule(path, typeRules[node.InstanceType], AnonymizerRuleType.TypeRule, node.InstanceType); rules.Add(rule); rulePaths.Add(rule.Path); } var children = node.Children().Cast <ElementNode>(); foreach (var child in children) { TransformTypeRulesToPathRules(child, typeRules, rules, rulePaths); } }