public virtual void AddCard(int index, Card card, int quantity) { var cardInList = Cards.FirstOrDefault(c => c.Index == index); if (cardInList != null && cardInList.Card == card) { cardInList.Quantity += quantity; } else if (Cards.Any(c => c.Card == card)) { throw new Exception("The indexes of given card don't match"); } else { cardInList = new CardInList(card, this, index, quantity); Cards.Add(cardInList); card.AddToList(cardInList); } }