using System.Collections.ObjectModel; namespace Manager.YouTube; public class YouTubeClientCollection : KeyedCollection { protected override string GetKeyForItem(YouTubeClient item) { return item.Id; } public new void Add(YouTubeClient client) { if (Items.Contains(client)) { var index = Items.IndexOf(client); Items[index] = client; } else { Items.Add(client); } } }