public async Task <NotificationProfileDetailModel> Handle(GetNotificationProfileDetailQuery request, CancellationToken cancellationToken) { var entity = await _notificationProfileService.GetNotificationProfile(request.Id); var users = _context.ApplicationUsers.Include(x => x.JobPosition) .Where(x => entity.Users.Contains(x.Id)); var allEventsInDb = await _eventService.GetEvents(); var result = allEventsInDb.Where(x => entity.Events.Contains(x.Id)).ToList(); return(new NotificationProfileDetailModel() { Id = entity.Id, Name = entity.Name, UserList = users.ToList(), EventList = result }); }