private static void AddToDictionary( string key, string value, IDictionary<string, ICollection<string>> dictionary) { ICollection<string> targetCollection; if (!dictionary.TryGetValue(key, out targetCollection)) { targetCollection = new List<string>(); dictionary.Add(key, targetCollection); } if (!targetCollection.Contains(value)) { targetCollection.Add(value); } }