private static Dictionary <string, string> ApplyExclusions(Dictionary <string, string> dictionary, IEnumerable <string> exclusions, int maxLength) { if (dictionary == null || dictionary.Count == 0) { return(dictionary); } foreach (string key in dictionary.Keys.Where(k => String.IsNullOrEmpty(k) || StringExtensions.AnyWildcardMatches(k, exclusions, true)).ToList()) { dictionary.Remove(key); } foreach (string key in dictionary.Where(kvp => kvp.Value != null && kvp.Value.Length > maxLength).Select(kvp => kvp.Key).ToList()) { dictionary[key] = String.Format("Value is too large to be included."); } return(dictionary); }