public static PropertyInfo GetOrderByFromExpression(Expression expression)
        {
            var visitor = new OrderByPropertyInfoVisitor();

            visitor.Visit(expression);
            return(visitor.Property);
        }
        public override Expression Visit(Expression node)
        {
            var methodCall = node as MethodCallExpression;

            if (methodCall != null && (methodCall.Method.Name == "OrderBy" || methodCall.Method.Name == "OrderByDescending"))
            {
                var visitor = new OrderByPropertyInfoVisitor();
                visitor.Visit(methodCall);
                if (visitor.Property != null)
                {
                    OrderedProperties.Add(visitor.Property);
                }
            }
            return(base.Visit(node));
        }