private static Expression Parametrize(
     Expression expression,
     ParameterExpression arrayOfValuesParameter)
 {
     return(ClosureCapturedValuesParametrizer.GetParametrizedExpression(
                expression,
                arrayOfValuesParameter));
 }
        public static Expression GetParametrizedExpression(
            Expression expression,
            ParameterExpression arrayOfValues)
        {
            var visitor          = new ClosureCapturedValuesParametrizer(arrayOfValues);
            var parametrizedBody = visitor.Visit(expression);

            return(parametrizedBody.Type.IsPrimitive
                                ? Expression.Convert(parametrizedBody, typeof(object))
                                : parametrizedBody);
        }