public void AddPlayer(Player player) { if (CheckIfPlayerExists(player)) { throw new InvalidOperationException("Player already exists in this team"); } this.players.Add(player); }
private bool CheckIfPlayerExists(Player player) { return this.players.Any(p => p.FirstName == player.FirstName && p.LastName == player.LastName); }