private static bool TryWriteInjectedExpression(Expression expression, TranslationContext context)
        {
            var parameter = expression.GetOuterExpression <ParameterExpression>();

            if (!context.OptionsTypes.Contains(parameter?.Type))
            {
                return(false);
            }

            context.InjectRuntimeExpression(expression, parameter);

            return(true);
        }
        private static bool TryWriteInjectedMethod(MethodCallExpression expression, TranslationContext context)
        {
            if (!expression.Type.IsSystemType())
            {
                return(false);
            }

            var parameter = expression.Object.GetOuterExpression <ParameterExpression>();

            if (parameter != null && !context.OptionsTypes.Contains(parameter.Type))
            {
                return(false);
            }

            if (parameter == null && !expression.Method.IsStatic)
            {
                return(false);
            }

            var parameterExpressions = (from a in expression.Arguments
                                        let p = a.GetOuterExpression <ParameterExpression>()
                                                where p != null
                                                select p).ToList();

            if (parameterExpressions.Any(p => p.Type == context.ModelType))
            {
                return(false);
            }

            if (parameter == null && parameterExpressions.Any())
            {
                parameter = parameterExpressions.FirstOrDefault(p => context.OptionsTypes.Contains(p.Type));
            }

            if (parameter == null)
            {
                return(false);
            }

            context.InjectRuntimeExpression(expression.Object ?? expression, parameter);
            return(true);
        }