public async Task<IEnumerable<Episode>> GetNewEpisodesAsync(Podcast podcast)
{
try
{
Podcast newPodcast = await feedParser.GetPodcastAsync(podcast.FeedUrl.ToString());
var newEpisodes = new List<Episode>();
foreach (var episode in newPodcast.Episodes)
{
if (!podcast.Episodes.Contains(episode))
{
newEpisodes.Add(episode);
}
}
return newEpisodes.OrderBy(e => e.Published);
}
catch (Exception ex)
{
throw new GetPodcastException(podcast.FeedUrl.ToString(), ex);
}
}