private static async Task <Document> CreateMappingLambda(Document document, InvocationExpressionSyntax invocation, CancellationToken cancellationToken)
        {
            var semanticModel = await document.GetSemanticModelAsync(cancellationToken);

            var syntaxGenerator        = SyntaxGenerator.GetGenerator(document);
            var methodInvocationSymbol = semanticModel.GetSymbolInfo(invocation.Expression);
            var mappingOverload        = methodInvocationSymbol.CandidateSymbols.OfType <IMethodSymbol>().FirstOrDefault(IsMappingMethod);

            if (mappingOverload == null)
            {
                return(document);
            }

            var sourceElementType = ((INamedTypeSymbol)mappingOverload.Parameters[0].Type).TypeArguments[0];
            var targetElementType = GetExpressionType(semanticModel, invocation);

            if (targetElementType == null)
            {
                return(document);
            }

            var contextAssembly = semanticModel.FindContextAssembly(invocation);
            var mappingEngine   = new MappingEngine(semanticModel, syntaxGenerator, contextAssembly);
            var mappingLambda   = mappingEngine.CreateMappingLambda("x", sourceElementType, targetElementType, new MappingPath());

            return(await document.ReplaceNodes(invocation, invocation.WithArgumentList(SyntaxFactory.ArgumentList().AddArguments(SyntaxFactory.Argument((ExpressionSyntax)mappingLambda))), cancellationToken));
        }