private async Task InitializePopular() { for (int i = 1; i <= _popularPages; i++) { var popularJson = await _movieDbApi.GetPopular(i); foreach (var result in popularJson.Results) { _importSeriesIds.Add(result.Id); } } foreach (var seriesId in _importSeriesIds) { var creditsJson = await _movieDbApi.GetCredits(seriesId); if (creditsJson != null) { foreach (var cast in creditsJson.CastJson) { if (cast.Id != null && !_importPersonsIds.Contains(cast.Id.Value)) { _importPersonsIds.Add(cast.Id.Value); } } foreach (var crew in creditsJson.CrewJson) { if (crew.Id != null && !_importPersonsIds.Contains(crew.Id.Value)) { _importPersonsIds.Add(crew.Id.Value); } } } } }