private static ExpressionMetadata CreateExpressionMetadata(ExpressionMetadataChainItem expressionMetadataChainItem, ExpressionMetadataChain chain)
        {
            var expressionModelMetadata = CreateExpressionModelMetadata(expressionMetadataChainItem, chain);
            var response = ExpressionConverter.ConvertModelQueryExpression(expressionMetadataChainItem.Expression, expressionModelMetadata);

            return(response);
        }
        private static ExpressionModelMetadata CreateExpressionModelMetadata(ExpressionMetadataChainItem expressionMetadataChainItem, ExpressionMetadataChain chain)
        {
            var arguments = expressionMetadataChainItem.Expression.Arguments;

            if (arguments.Count < 2 || !(arguments.Skip(1).First() is UnaryExpression unaryExpression))
            {
                return(new ExpressionModelMetadata()
                {
                    Type = expressionMetadataChainItem.InputDtoType.Type
                });
            }
            if (!(unaryExpression.Operand is LambdaExpression lambdaExpressionOperand))
            {
                throw new ArgumentException("Operand is not LambdaExpression");
            }

            var parameter = lambdaExpressionOperand.Parameters.First(x => x.Type == expressionMetadataChainItem.InputDtoType.Type);

            return(new ExpressionModelMetadata()
            {
                Type = parameter.Type,
                Name = parameter.Name
            });
        }