private PageRequest(int page, int size, Sorted sortBy)
 {
     Page   = page;
     Size   = size;
     SortBy = sortBy;
 }
        public static IQueryable <TSource> SortBy <TSource>(this IQueryable <TSource> source, Sorted sort)
        {
            if (sort == Sorted.Unsorted)
            {
                return(source);
            }

            if (!(sort is Sort <TSource> sorted))
            {
                throw new Exception("Illegal sorted expression type -SortBy ");
            }
            //  return source;
            if (sort.Order == OrderType.Asc)
            {
                return(source.OrderBy(sorted.SortBy));
            }

            return(source.OrderByDescending(sorted.SortBy));
        }