private static Expression MakeWhereMethod(Expression context, Expression argContext, string methodName, Expression[] args)
 {
     ExpectArgsCount(1, args, methodName);
       var predicate = args.First();
       ExpectArgTypeToBe(predicate.Type, typeof(bool), methodName);
       var lambda = Expression.Lambda(predicate, argContext as ParameterExpression);
       return ExpressionUtil.MakeExpressionCall(new []{typeof(Queryable), typeof(Enumerable)}, "Where", new Type[] {argContext.Type}, context, lambda);
 }
        private static Expression MakeOrderByMethod(Expression context, Expression argContext, string methodName, Expression[] args)
        {
            ExpectArgsCount(1, args, methodName);
              var column = args.First();
              var lambda = Expression.Lambda(column, argContext as ParameterExpression);

              return ExpressionUtil.MakeExpressionCall(new []{typeof(Queryable), typeof(Enumerable)}, "OrderBy", new Type[] {argContext.Type, column.Type}, context, lambda);
        }
        private static Expression MakeTakeMethod(Expression context, Expression argContext, string methodName, Expression[] args)
        {
            ExpectArgsCount(1, args, methodName);
              var amount = args.First();
              ExpectArgTypeToBe(amount.Type, typeof(int), methodName);

              return ExpressionUtil.MakeExpressionCall(new []{typeof(Queryable), typeof(Enumerable)}, "Take", new Type[] {argContext.Type}, context, amount);
        }
        private static Expression MakeOptionalFilterArgumentCall(Expression context, Expression argContext, string methodName, Expression[] args, string actualMethodName)
        {
            ExpectArgsCountBetween(0, 1, args, methodName);

              var allArgs = new List<Expression> { context };
              if (args.Count() == 1) {
            var predicate = args.First();
            ExpectArgTypeToBe(predicate.Type, typeof(bool), methodName);
            allArgs.Add(Expression.Lambda(predicate, argContext as ParameterExpression));
              }

              return ExpressionUtil.MakeExpressionCall(new []{typeof(Queryable), typeof(Enumerable)}, actualMethodName, new Type[] {argContext.Type}, allArgs.ToArray());
        }