/// <summary>
        /// Create and return SimEngineContext with the given extensions path and
        /// a Simio Project at projectFullPath.
        /// Returns null if there is errors are encountered, along with an explanation.
        /// Note that the project can load with a warnings list, which is null if there are no errors.
        /// Load the project file and return a SimioProject
        /// </summary>
        /// <param name="projectFullPath"></param>
        public static SimEngineContext CreateContext(string extensionsPath, out string explanation)
        {
            explanation = "";

            try
            {
                SimEngineContext context = new SimEngineContext(extensionsPath);

                return(context);
            }
            catch (Exception ex)
            {
                explanation = $"Cannot Create Context with ExtensionsPath={extensionsPath} Err={ex.Message}";
                return(null);
            }
        }
        /// <summary>
        /// Save the given project to the 'savePath'.
        /// </summary>
        /// <param name="project"></param>
        /// <param name="savePath"></param>
        public static bool SaveProject(SimEngineContext context, string savePath, out string explanation)
        {
            explanation = "";
            string marker = "Begin.";

            string[] warnings;

            // If project not loaded, return error
            if (context == null || context.CurrentProject == null)
            {
                explanation = $"Context or Project is null.";
                return(false);
            }

            string folderPath = Path.GetDirectoryName(savePath);

            if (Directory.Exists(folderPath) == false)
            {
                explanation = $"FolderPath={folderPath} not found.";
                return(false);
            }

            try
            {
                // Open project file.
                marker = $"Saving Project={context.CurrentProject.Name} to {savePath}.";
                LogIt($"Info: {marker}");
                if (!SimioProjectFactory.SaveProject(context.CurrentProject, savePath, out warnings))
                {
                    LogIt($"SaveProject failed.");
                }

                marker = $"Saved Project={savePath} with {warnings.Count()} warnings.";
                int ii = 1;
                foreach (string warning in warnings)
                {
                    LogIt($"Warning: {ii++}{warning}");
                }

                return(true);
            }
            catch (Exception ex)
            {
                explanation = $"Cannot Save Simio Project={context.CurrentProject.Name} to {savePath} Err={ex.Message}";
                return(false);
            }
        }