public async Task <Condition> GetCurrentAsync() { WeatherFacade weatherFacade = new WeatherFacade(API.Value); Condition weather = null; using (appDB){ WeatherRepository repo = new WeatherRepository(appDB); var cons = await repo.LatestConditionAsync(); if (cons.Count > 0) { weather = cons[0]; TimeSpan span = (DateTime.Now - weather.timeStamp); if (span.Minutes < 10) { Console.WriteLine("db"); return(weather); } } Console.WriteLine("api"); var w = weatherFacade.GetCurrentWeatherDetail(); if (w != null) { await repo.InsertAsync(w); weather = w; } } return(weather); }