private async Task <Streams> AddGames(Streams s) { // check if register is missing a game var dummyStreamsObj = new Streams(); dummyStreamsObj.Stream = new List <Stream>(); foreach (var item in s.Stream) { if (!gameRegister.ContainsKey(item.GameId)) { dummyStreamsObj.Stream.Add(item); } } // if missing add them if (dummyStreamsObj.Stream.Count > 0) { Games gam = await HelixAPI.GetGames(dummyStreamsObj.GenerateUserIds()); if (!gam.IsOk) { return(s); } foreach (var item in gam.Game) { gameRegister.Add(item.Id, item); } } // populate parameter object with game names foreach (var item in s.Stream) { try { item.Game = gameRegister[item.GameId].Name; } catch (KeyNotFoundException) { item.Game = " "; } } return(s); }