public void OnElapsedTime(object source, ElapsedEventArgs e) { WriteToFile("Service is recall at " + DateTime.Now); try { var rates = _ecbRateDownloader.DownloadRates().GetAwaiter().GetResult(); _ratesRepository.AddOrIgnoreAsync(rates).GetAwaiter().GetResult(); WriteToFile("Service has finished recall at " + DateTime.Now); } catch (Exception exception) { WriteToFile("Service has failed at " + DateTime.Now + " with " + exception.StackTrace + " " + exception.Message); } }