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