async protected override Task <DataListPageResult <TmdbItem> > FetchPageAsync(int pageNumber) { if (_config == null) { _config = await TheMovieDb.GetConfiguration(); } if (personID == null) { personID = 0; var resultPerson = await TheMovieDb.SearchPersonAsync(_query, 1); if (resultPerson.Results != null && resultPerson.Results.Count == 1) { personID = resultPerson.Results[0].Id; } } if (personID == 0) { return(new DataListPageResult <TmdbItem>(0, PageSize, pageNumber, new List <TmdbItem>())); } if (_credits == null) { _credits = await TheMovieDb.GetCreditsAsync(personID.Value); } List <TmdbItem> list = new List <TmdbItem>(); var movies = _credits.Cast.Skip((pageNumber - 1) * PageSize).Take((pageNumber - 1) * PageSize + PageSize).Select(r => r.Id); foreach (var movieId in movies) { var movie = await TheMovieDb.GetMovieAsync(movieId); var tmdbItem = new TmdbItem (_config, movie); list.Add(tmdbItem); } return(new DataListPageResult <TmdbItem>(_credits.Cast.Count, PageSize, pageNumber, list)); }