public IList<CommentDetailsModel> GetCommentDetails(
     CommentSearchCriteriaModel criteria = null,
     bool includeText = false, bool includeUser = false, bool includeIssue = false)
 {
     return Search(criteria).Select(
         c => BuildCommentDetails(c, includeUser, includeIssue)).ToList();
 }
        IList<Comment> Search(CommentSearchCriteriaModel criteria)
        {
            if (criteria == null) criteria = new CommentSearchCriteriaModel();

            var comments = Repo<Comment>().Find();

            if (criteria.UserId.HasValue)
                comments = comments.Where(c => c.UserId == criteria.UserId.Value);
            if (criteria.IssueId.HasValue)
                comments = comments.Where(c => c.IssueId == criteria.IssueId.Value);
            if (criteria.Text != null)
                comments = comments.Where(c => c.Text.Contains(criteria.Text));

            if (criteria.SortField == "ModifiedOn") comments = comments.OrderBy(c => c.ModifiedOn);
            else comments = comments.OrderBy(u => u.CreatedOn);

            return comments.Skip(criteria.Skip ?? 0).Take(criteria.Take ?? 10).ToList();
        }