private async void searchBarTextChanged(object sender, TextChangedEventArgs e)
        {
            SearchBar searchBar = (SearchBar)sender;
            CollectionViewSampleViewModel viewModel = (BindingContext as CollectionViewSampleViewModel);

            // If iOS Clear
            if (searchBar.SearchCommandParameter != null)
            {
                // If Android Clear
                if (!string.IsNullOrEmpty(searchBar.SearchCommandParameter.ToString()))
                {
                    await viewModel.ExecuteOnPerformSearchCommandAsync(searchBar);
                }
                else
                {
                    if (viewModel.IsAndroid)
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            searchBar.Unfocus();
                        });
                    }
                    await viewModel.ExecuteOnPerformSearchCommandAsync(searchBar);
                }
            }
            else
            {
                searchBar.SearchCommandParameter = "";
                searchBar.Text = "";
            }
        }
        public void ShouldPerformSearchCommandMarkRetrieveSearchResults()
        {
            //arrange
            viewModel = new CollectionViewSampleViewModel(DataManager);
            PopularBrandsViewModel popularBrandsViewModel = new PopularBrandsViewModel();

            //act
            Task.Run(async() =>
            {
                await viewModel.LoadData();
            }).GetAwaiter().GetResult();

            popularBrandsViewModel = viewModel.PopularBrands.FirstOrDefault();

            Task.Run(async() =>
            {
                await viewModel.ExecuteOnPerformSearchCommandAsync(popularBrandsViewModel.ItemTitle);
            }).GetAwaiter().GetResult();

            var searchResults = new ObservableCollection <PopularBrandsViewModel>(
                viewModel.PopularBrandsFromServer.Where(x => x.ItemTitle.ToUpper().Contains(popularBrandsViewModel.ItemTitle.ToUpper()) ||
                                                        x.Text.ToUpper().Contains(popularBrandsViewModel.ItemTitle.ToUpper())));

            IEnumerable <PopularBrandsViewModel> differences = viewModel.PopularBrands.Except(searchResults);

            //assert
            Assert.AreEqual(searchResults.Count, viewModel.PopularBrands.Count);
            Assert.AreEqual(0, differences.Count());
        }