private MethodDeclarationSyntax GenerateCallerMethod(
            DurableFunction function,
            bool withRetry
            )
        {
            var parameters = function.Parameters;

            var methodName = $"{function.Name}{(withRetry ? "WithRetry" : string.Empty)}";

            var leadingTrivia = AsCrefSummary(function.FullTypeName);

            var parameterList = AsParameterList()
                                .AddParameters(withRetry ? AsParameter("RetryOptions", "options") : null)
                                .AddParameters(function.Parameters.Select(p => AsParameter(p.Type.ToString(), p.Name)).ToArray());

            return(SyntaxFactory.MethodDeclaration(SyntaxFactory.ParseTypeName(function.ReturnType), methodName)
                   .WithLeadingTrivia(leadingTrivia)
                   .WithParameterList(parameterList)
                   .WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)));
        }
        private MethodDeclarationSyntax GenerateCallerMethod(
            DurableFunction function,
            bool withRetry
            )
        {
            var parameters = function.Parameters;

            var methodName = $"{function.Name}{(withRetry ? "WithRetry" : string.Empty)}";

            var leadingTrivia = AsCrefSummary(function.FullTypeName);
            var modifiers     = AsModifierList(SyntaxKind.PublicKeyword);

            var parameterList = AsParameterList()
                                .AddParameters(withRetry ? AsParameter("RetryOptions", "options") : null)
                                .AddParameters(function.Parameters.Select(p => AsParameter(p.Type.ToString(), p.Name)).ToArray());

            var callMethodName = (function.Kind == DurableFunctionKind.Orchestration) ?
                                 $"CallSubOrchestrator{((withRetry) ? "WithRetry" : string.Empty)}Async" :
                                 $"CallActivity{((withRetry) ? "WithRetry" : string.Empty)}Async";
            var callGenerics          = function.CallGenerics;
            var functionNameParameter = $"\"{function.Name}\"";
            var callRetryParameter    = withRetry ? ", options" : string.Empty;
            var callContextParameters = (parameters.Count == 0) ?
                                        ", null" :
                                        (parameters.Count == 1) ?
                                        $", {parameters[0].Name}" :
                                        $", ({string.Join(",", parameters.Select(p => p.Name))})";
            var callParameters = $"{functionNameParameter}{callRetryParameter}{callContextParameters}";


            var bodyText        = $"return _context.{callMethodName}{callGenerics}({callParameters});";
            var returnStatement = SyntaxFactory.ParseStatement(bodyText);
            var bodyBlock       = SyntaxFactory.Block(returnStatement);

            return(SyntaxFactory.MethodDeclaration(SyntaxFactory.ParseTypeName(function.ReturnType), methodName)
                   .WithModifiers(modifiers)
                   .WithLeadingTrivia(leadingTrivia)
                   .WithParameterList(parameterList)
                   .WithBody(bodyBlock));
        }