public async Task <AppUserDto> GetUserById(string userId, string callerId) { if (userId == null) { throw new InvalidDataException("Provided userId was null"); } var foundUser = await usersRepository.GetByIdAsync(userId); if (foundUser == null) { throw new KeyNotFoundException("User was not found"); } var user = foundUser.ToAppUserDto(); user.IsMessagingRestricted = bansService.IsBannedFromMessagingWith(callerId, userId); user.IsBlocked = bansService.IsBannedFromMessagingWith(userId, callerId); return(user); }