public async Task <IEnumerable <CommentDto> > Handle(GetAllCommentsQuery request, CancellationToken cancellationToken)
        {
            var query = this.context.Comments.Include(c => c.Guest).ThenInclude(g => g.User).Where(c => !c.IsDeleted);

            query = ApplyFilters(request, query);

            var comments = await query.ToListAsync(cancellationToken).ConfigureAwait(false);

            return(comments.Select(c => new CommentDto(c)));
        }
        private static IQueryable <Domain.Entities.Comment> ApplyFilters(GetAllCommentsQuery filters, IQueryable <Domain.Entities.Comment> query)
        {
            if (filters.Approved != null)
            {
                query = query.Where(c => c.Approved == filters.Approved);
            }

            if (filters.ApartmentId != null)
            {
                query = query.Where(c => c.ApartmentId == filters.ApartmentId);
            }

            return(query);
        }