private ISolution updateMethodDeclaration(ISolution solution)
                    {
                        // Get the qualified name of the RefactoringType containing the declaration.
                        var qualifidedNameAnalyzer = AnalyzerFactory.GetQualifiedNameAnalyzer();
                        qualifidedNameAnalyzer.SetSyntaxNode(declaration);
                        var typeName = qualifidedNameAnalyzer.GetOutsideTypeQualifiedName();

                        // Get all documents in the given originalSolution.
                        var solutionAnalyzer = AnalyzerFactory.GetSolutionAnalyzer();
                        solutionAnalyzer.SetSolution(solution);
                        var documents = solutionAnalyzer.GetAllDocuments();

                        // Get the simplified name of the method
                        var methodName = ((MethodDeclarationSyntax) declaration).Identifier.ValueText;

                        // For each document in the originalSolution.
                        foreach (var document in documents)
                        {
                            var documentAnalyzer = AnalyzerFactory.GetDocumentAnalyzer();
                            documentAnalyzer.SetDocument(document);

                            // If the document contains the RefactoringType in which the method is declared.
                            if (documentAnalyzer.ContainsQualifiedName(typeName))
                            {
                                // Get the root of the current document.
                                var root = ((SyntaxNode) document.GetSyntaxRoot());

                                // Find the method
                                SyntaxNode method = root.DescendantNodes().Where(
                                    // Find all the method declarations.
                                    n => n.Kind == SyntaxKind.MethodDeclaration).
                                    // Convert all of them to the RefactoringType MethodDeclarationSyntax.
                                    Select(n => (MethodDeclarationSyntax) n).
                                    // Get the one whose name is same with the given method declaration.
                                    First(m => m.Identifier.ValueText.Equals(methodName));

                                // If we can find this method.
                                if (method != null)
                                {
                                    // Get the updated method declaration.
                                    var methodAnalyzer = AnalyzerFactory.GetMethodDeclarationAnalyzer();
                                    methodAnalyzer.SetMethodDeclaration(method);
                                    var updatedMethod = methodAnalyzer.AddParameters(typeNameTuples);

                                    // Update the root, document and finally return the code action.
                                    var updatedRoot = new MethodDeclarationRewriter(method, updatedMethod).Visit(root);
                                    return solution.UpdateDocument(document.Id, updatedRoot);
                                }
                            }
                        }
                        return solution;
                    }
                    private IDocument updateMethodDeclaration(IDocument document)
                    {
                        // Get the simplified name of the method
                        var methodName = ((MethodDeclarationSyntax) declaration).Identifier.ValueText;
                        var documentAnalyzer = AnalyzerFactory.GetDocumentAnalyzer();
                        documentAnalyzer.SetDocument(document);

                        // Get the root of the current document.
                        var root = ((SyntaxNode) document.GetSyntaxRoot());

                        // Find the method
                        SyntaxNode method = root.DescendantNodes().Where(
                            // Find all the method declarations.
                            n => n.Kind == SyntaxKind.MethodDeclaration).
                            // Convert all of them to the RefactoringType MethodDeclarationSyntax.
                            Select(n => (MethodDeclarationSyntax) n).
                            // Get the one whose name is same with the given method declaration.
                            First(m => m.Identifier.ValueText.Equals(methodName));

                        // If we can find this method.
                        if (method != null)
                        {
                            // Get the updated method declaration.
                            var methodAnalyzer = AnalyzerFactory.GetMethodDeclarationAnalyzer();
                            methodAnalyzer.SetMethodDeclaration(method);
                            var updatedMethod = methodAnalyzer.AddParameters(new[] {typeNameTuple});

                            // Update the root, document and finally return the code action.
                            var updatedRoot = new MethodDeclarationRewriter(method, updatedMethod).
                                Visit(root);
                            return document.UpdateSyntaxRoot(updatedRoot);
                        }
                        return document;
                    }