public async Task DownloadNewPodcasts(string targetDirectoryPath, string fileFormat, DateTime stopDateTime) { _loggerService.Info("Started loading podcasts info"); var podcasts = await _podcastService.GetNewPodcasts(stopDateTime); _loggerService.Info("Finished loading podcasts info"); foreach (var podcast in podcasts) { var fileName = string.Format(fileFormat, podcast.Name, podcast.Date); var filePath = _pathService.Combine(targetDirectoryPath, fileName); if (!_fileService.Exists(filePath)) { var bytes = await _httpClientService.GetByteArrayAsync(podcast.DownloadLink); await _fileService.WriteAllBytes(filePath, bytes); _loggerService.Info($"Downloaded {fileName}"); } } }