public async Task <List <League> > Handle(GetLeaguesQuery request, CancellationToken cancellationToken) { if (request.UseCache) { var cacheLeagues = await leagueRepository.FindAll(); if (cacheLeagues.Count != 0) { return(cacheLeagues); } } var result = await poeTradeClient.Fetch <League>("data/leagues"); await leagueRepository.SaveAll(result.Result); return(result.Result); }