public async Task <int> CheckAndUpdateSeasonCounter(TvShowDetails tvshow) { int n = 0; //if there is a new season update season number and so make tvshow unseen if (tvshow.SeasonCount < tvshow.Seasons.Count) { tvshow.SeasonCount = tvshow.Seasons.Count; n = await DB.UpdateTvShowAsync(new TvShow((TvShow)tvshow)); } //if all episode of season are seen update number in tvshow int SeasonSeen = tvshow.Seasons.Where(s => s.EpisodeCount == s.EpisodeSeen).Count(); if (SeasonSeen > tvshow.SeasonSeen) { tvshow.SeasonSeen = SeasonSeen; n = await DB.UpdateTvShowAsync(new TvShow((TvShow)tvshow)); } return(n); }