private CancellationTokenSource FetchAndLoadVault() { var cts = new CancellationTokenSource(); if (PresentationSections.Count > 0 && _syncService.SyncInProgress) { return(cts); } _filterResultsCancellationTokenSource?.Cancel(); Task.Run(async() => { IEnumerable <Models.Cipher> ciphers; if (_folder || !string.IsNullOrWhiteSpace(_folderId)) { ciphers = await _cipherService.GetAllByFolderAsync(_folderId); } else if (!string.IsNullOrWhiteSpace(_collectionId)) { ciphers = await _cipherService.GetAllByCollectionAsync(_collectionId); } else if (_favorites) { ciphers = await _cipherService.GetAllAsync(true); } else { ciphers = await _cipherService.GetAllAsync(); } Ciphers = ciphers .Select(s => new Cipher(s, _appSettingsService)) .OrderBy(s => { if (string.IsNullOrWhiteSpace(s.Name)) { return(2); } return(s.Name.Length > 0 && Char.IsDigit(s.Name[0]) ? 0 : (Char.IsLetter(s.Name[0]) ? 1 : 2)); }) .ThenBy(s => s.Name) .ThenBy(s => s.Subtitle) .ToArray(); try { FilterResults(Search.Text, cts.Token); } catch (OperationCanceledException) { } }, cts.Token); return(cts); }