public async Task <ActionResult <List <ConversationDTO> > > Search(string searchString) { var user = await userFinder.FindByClaimsPrincipal(User); var result = await conversationManager.SearchConversations(searchString, user.UserName); var userNames = await userFinder.SearchUsernames(searchString); var existingPrivateConvUsers = result.Where(c => !c.IsGroup).SelectMany(c => c.UserNames); userNames = userNames.Where(name => !existingPrivateConvUsers.Contains(name)).ToList(); var notExistingConvs = userNames.Select(name => new ConversationDTO { IsGroup = false, UserNames = new List <string> { name } }); result.AddRange(notExistingConvs); return(Ok(result)); }