public void SetGemsInSlot(IReadOnlyList <Gem> value, ItemSlot slot) { if (value.Any(s => s.ItemSlot != slot)) { throw new ArgumentException("Gems for a slot must all have that slot as ItemSlot", nameof(value)); } var oldValue = GetGemsInSlot(slot); if (oldValue.Any() && value.Any()) { Gems.RemoveAndAdd(oldValue, value); } else if (value.Any()) { Gems.Add(value); } else if (oldValue.Any()) { Gems.Remove(oldValue); } }