public IEnumerable <Player> GetAllPlayers() { var query = new QueryBuilder <Player>(); var players = _mongoRepository.GetRepository <Player>().Collection.Find(query.Where(x => !x.IsRetired)).DistinctBy(x => x.SteamId).ToList(); var steamIds = string.Join(",", players.Select(x => x.SteamId).ToList()); var avatars = new SteamApi().GetAvatarUrlBySteamId(steamIds); foreach (var player in players) { player.ImagePath = avatars.FirstOrDefault(x => x.Key == player.SteamId).Value; } return(players); }