public async Task <List <AppUserDto> > FindUsersInChat(int chatId, string username, string caller) { if (!await usersConversationsRepository.Exists(caller, chatId)) { throw new UnauthorizedAccessException("Caller of this method must be the part of conversation."); } var result = (await usersConversationsRepository.FindUsersInChat(chatId, username)) .Select(x => x.ToAppUserDto()) .ToList(); foreach (var user in result) { user.IsBlockedInConversation = await bansService.IsBannedFromConversation(chatId, user.Id); user.ChatRole = await GetChatRole(user.Id, chatId); } return(result); }