public async Task <IEnumerable <RatesDTO> > GetAllRatesAsync() { IEnumerable <Rates> rates = null; using (var client = new HttpClient()) { HttpResponseMessage response = await client.GetAsync(path); if (response.IsSuccessStatusCode) { rates = await response.Content.ReadAsAsync <IEnumerable <Rates> >(); await repository.DeleteAllRatesAsync(); await repository.AddRatesAsync(rates); } else { rates = await repository.GetRatesAsync(); } return(mapper.Map <IEnumerable <RatesDTO> >(rates)); } }