private async Task DoSearch(string searchTerm, CancellationToken token) { token.ThrowIfCancellationRequested(); IsSearching = true; token.ThrowIfCancellationRequested(); searchResults.Clear(); token.ThrowIfCancellationRequested(); var results = await repository.FindAsync(searchTerm); token.ThrowIfCancellationRequested(); await searchResults.AddAllAsync(results.Keys); token.ThrowIfCancellationRequested(); await TaskEx.WhenAll(results.Values); token.ThrowIfCancellationRequested(); IsSearching = false; }