private static void OnConfirmUpdateProjectFiles()
        {
            if (m_ConversionHelper == null)
            {
                // Something wrong happened midway but we can't recover, so let users restart the process if they need to.
                return;
            }

            m_CurrentListDialog = null;

            AssetDatabase.StartAssetEditing();
            m_ConversionHelper.m_AssetEditingStarted = true;
            m_ConversionHelper.m_CurrentIndex        = 0;

            m_CurrentTask =
                new GUIDConversionTask(kAssetGUIDConverterName, "Saving modified assets", SaveModifiedAssets, CancelConversion);
            m_CurrentTask.Start();
        }
        internal static bool StartConversion(List <AssetConversionRecord> conversionData, List <string> pathsToScan, bool invert = false, bool showUIDialogs = true)
        {
            if (pathsToScan == null || pathsToScan.Count == 0)
            {
                if (showUIDialogs)
                {
                    EditorUtility.DisplayDialog(kAssetGUIDConverterName,
                                                "Error: No paths to scan, aborting process.", "OK", null);
                }
                return(false);
            }

            if (conversionData == null || conversionData.Count == 0)
            {
                if (showUIDialogs)
                {
                    EditorUtility.DisplayDialog(kAssetGUIDConverterName,
                                                "Error: conversion data not found, aborting process.", "OK", null);
                }
                return(false);
            }

            if (!CheckConversionPossible(showUIDialogs))
            {
                return(false);
            }

            if (m_ConversionHelper != null)
            {
                if (showUIDialogs)
                {
                    // A conversion is already in process, we need to cancel it if we want to run a new one.
                    if (!EditorUtility.DisplayDialog(kAssetGUIDConverterName,
                                                     "A conversion is already in progress, do you want to interrupt that and start a new one?",
                                                     "Yes", "No"))
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }

                if (m_CurrentTask != null)
                {
                    m_CurrentTask.Stop("Interrupted by new conversion request");
                    m_CurrentTask = null;
                }

                if (m_CurrentListDialog != null)
                {
                    m_CurrentListDialog.CloseWindow();
                    m_CurrentListDialog = null;
                }

                m_ConversionHelper = null;
            }

            m_ConversionHelper = new GUIDConversionHelper
            {
                m_ConversionData = new List <AssetConversionRecord>(conversionData)
            };

            if (invert)
            {
                InvertConversion(m_ConversionHelper.m_ConversionData);
            }

            m_ConversionHelper.m_ProjectPath = Path.GetFullPath(kAssetsFolderName + "/..");
            string[] searchInFolders = pathsToScan.ToArray();

            // Get list of GUIDs for assets that might contain references to previous GUIDs that require updating.
            m_ConversionHelper.m_ProjectAssetsGUIDs = new List <string>(AssetDatabase.FindAssets("t:Object", searchInFolders).Distinct());

            if (m_ConversionHelper.m_ProjectAssetsGUIDs.Count == 0)
            {
                if (showUIDialogs)
                {
                    if (m_ConversionHelper.m_Inverted)
                    {
                        EditorUtility.DisplayDialog(kAssetGUIDConverterName,
                                                    "No UI Toolkit package asset found to revert.", "OK", null);
                    }
                    else
                    {
                        EditorUtility.DisplayDialog(kAssetGUIDConverterName,
                                                    "No UI Toolkit package asset found to convert.", "OK", null);
                    }
                }

                m_ConversionHelper = null;

                return(false);
            }

            m_ConversionHelper.m_ShowUIDialogs          = showUIDialogs;
            m_ConversionHelper.m_Inverted               = invert;
            m_ConversionHelper.m_CurrentIndex           = 0;
            m_ConversionHelper.m_ProjectAssetsToConvert = new List <GUIDConversionHelper.AssetInfo>();
            m_ConversionHelper.m_AssetNamesToShowInUI   = new List <string>();

            m_CurrentTask =
                new GUIDConversionTask(kAssetGUIDConverterName,
                                       "Scanning project assets", ScanProjectFiles, CancelConversion);
            m_CurrentTask.Start();

            return(true);
        }