public async Task List(int page, int size) { try { IsBusy = true; currentPaged = await _pokedexService.ListAsync(page, size); if (currentPaged != null) { var types = currentPaged.Results.SelectMany(x => x.Types.Select(t => t.Type.Name)).Distinct().ToList(); IEnumerable <SelectableItem <string> > selectable; if (PokemonTypes != null && PokemonTypes.Any(d => d.Selected)) { selectable = types.Select(x => new SelectableItem <string>(x, PokemonTypes.Any(s => s.Item == x && s.Selected))); } else { selectable = types.Select(x => new SelectableItem <string>(x)); } TotalItems = currentPaged.Count; FilterItems(currentPaged.Results); PokemonTypes = new ObservableRangeCollection <SelectableItem <string> >(selectable); CurrentPage = page; } } catch (Exception ex) { throw; } finally { IsBusy = false; } }