public async Task BuildUser(AppUser user, string apiKey) { UnitOfWork tempUOW = new UnitOfWork(AppIdentityDbContext.Create()); AppUserManager tempUM = new AppUserManager(new UserStore <AppUser>(tempUOW.DbContext)); user = await tempUM.FindByIdAsyncWithStoreFilters(user.Id); if (user.UserSteamID == 0) { // possibly add default data here return; } string playerURL = String.Format("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={0}&steamids={1}&format=json", apiKey, user.UserSteamID); string result = new System.Net.WebClient().DownloadString(playerURL); JObject playerData = JObject.Parse(result); if (playerData["response"] != null && playerData["response"]["players"] != null) { user.LargeAvatar = (string)playerData["response"]["players"][0]["avatarfull"] ?? ""; user.MediumAvatar = (string)playerData["response"]["players"][0]["avatarmedium"] ?? ""; user.SmallAvatar = (string)playerData["response"]["players"][0]["avatar"] ?? ""; } string gamesURL = String.Format("http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key={0}&steamid={1}&format=json", apiKey, user.UserSteamID); result = new System.Net.WebClient().DownloadString(gamesURL); JObject gameData = JObject.Parse(result); if (gameData["response"] != null && gameData["response"]["games"] != null) { JArray jGames = (JArray)gameData["response"]["games"]; for (int i = 0; i < jGames.Count; i++) { int appId = (int)jGames[i]["appid"]; if (user.OwnedGames.Any(o => o.AppID == appId) == false) { user.AddOwnedGame(new OwnedGame((int)jGames[i]["appid"], (int)jGames[i]["playtime_forever"])); } } } tempUM.Update(user); tempUOW.Save(); tempUOW.Dispose(); }