public async Task <PlayerData> GetPlayerDataForCurrentUserAsync() { if (this.cache.CurrentUserData != null) { return(this.cache.CurrentUserData); } var playerData = await apiBrooker.GetAsync <PlayerData>( controllerName : controllerName); if (cache.TryAddValue(playerData.Id, playerData)) { this.cache.CurrentUserData = playerData; return(playerData); } if (cache.TryGetValue(playerData.Id, out playerData)) { return(playerData); } throw new InvalidOperationException("Failed to load player data."); }