public async Task <ActionResult <OAuthAppSearchResult> > SearchAsync(OAuthAppSearchCriteria criteria) { if (criteria.Sort.IsNullOrEmpty()) { criteria.Sort = "DisplayName:ASC"; } var apps = await _manager.ListAsync(x => x.OrderBySortInfos(criteria.SortInfos).Skip(criteria.Skip).Take(criteria.Take)); var appsTasks = apps.Select(async x => { var descriptor = new OpenIddictApplicationDescriptor(); await _manager.PopulateAsync(descriptor, x); descriptor.ClientSecret = ""; return(descriptor); }).ToList(); var result = new OAuthAppSearchResult { Results = await Task.WhenAll(appsTasks), TotalCount = (int)await _manager.CountAsync() }; return(result); }