private static async Task <InstallPackageAndAddImportData> GetInstallDataAsync(
                    PackageReference reference,
                    string versionOpt,
                    bool isLocal,
                    Document document,
                    SyntaxNode node,
                    bool placeSystemNamespaceFirst,
                    CancellationToken cancellationToken)
                {
                    var oldDocument = document;

                    (node, document) = await reference.ReplaceNameNodeAsync(
                        node, document, cancellationToken).ConfigureAwait(false);

                    var newDocument = await reference.provider.AddImportAsync(
                        node, reference.SearchResult.NameParts, document, placeSystemNamespaceFirst, cancellationToken).ConfigureAwait(false);

                    // We're going to be manually applying this new document to the workspace
                    // (so we can roll it back ourselves if installing the nuget package fails).
                    // As such, we need to do the postprocessing ourselves of tihs document to
                    // ensure things like formatting/simplification happen to it.
                    newDocument = await CleanupDocumentAsync(
                        newDocument, cancellationToken).ConfigureAwait(false);

                    var installOperation = new InstallPackageDirectlyCodeActionOperation(
                        reference._installerService, document, reference._source,
                        reference._packageName, versionOpt,
                        includePrerelease: false, isLocal: isLocal);

                    return(new InstallPackageAndAddImportData(
                               oldDocument, newDocument, installOperation));
                }