public static Dictionary<Guid, guidanceExplorer> addGuidanceExplorerObject(this Dictionary<Guid, guidanceExplorer> guidanceExplorers, guidanceExplorer newGuidanceExplorer, string xmlFile)
        {
            if (newGuidanceExplorer.notNull())
            {
                try
                {
                    var libraryGuid = newGuidanceExplorer.library.name.guid();

                    //check if the name is already there
                    foreach(guidanceExplorer guidanceExplorer in guidanceExplorers.Values)
                    {
                        if (guidanceExplorer.library.caption == newGuidanceExplorer.library.caption)
                        {
                            "[addGuidanceExplorerObject]: Skipping load due to duplicate Library name '{0}' was in both library {1} and {2}".error(guidanceExplorer.library.caption, guidanceExplorer.library.name,  newGuidanceExplorer.library.name);
                            return guidanceExplorers;
                        }
                    }
                    //check if the guid is already there
                    if (guidanceExplorers.hasKey(libraryGuid))
                    {
                        "[addGuidanceExplorerObject]: for {0} , duplicate LibraryID detected, assiging a new Library Id: {0}".error(newGuidanceExplorer.library.caption, libraryGuid);
                        libraryGuid = Guid.NewGuid();
                        newGuidanceExplorer.library.name = libraryGuid.str();
                        "[addGuidanceExplorerObject]: new ID for library {0} is now {1}".error(newGuidanceExplorer.library.caption, libraryGuid);
                        newGuidanceExplorer.xmlDB_Save_GuidanceExplorer(TM_Xml_Database.Current);//, false);
                    }
                    TM_Xml_Database.Current.GuidanceExplorers_Paths.add(newGuidanceExplorer, xmlFile); // add this mapping so that we can find it base on name
                    guidanceExplorers.Add(libraryGuid, newGuidanceExplorer);

                }
                catch//(Exception ex)
                {
                    "[addGuidanceExplorerObject] error importing guidanceExplorer: {0}".error(newGuidanceExplorer);
                }
            }
            return guidanceExplorers;
        }
        public static guidanceExplorer xmlDB_RenameGuidanceExplorer(this TM_Xml_Database tmDatabase, guidanceExplorer guidanceExplorer, string newCaption)
        {
            if (newCaption.isValidGuidanceExplorerName().isFalse())
            {
                "[TM_Xml_Database][xmlDB_RenameGuidanceExplorer] provided caption didn't pass validation regex".error();
                throw new Exception("Provided Library name didn't pass validation regex");
            }
            "[xmlDB_RenameGuidanceExplorer]".info();
            if(guidanceExplorer.notNull())
            {
                var existingCaption = guidanceExplorer.library.caption;
                var existingLibraryPath = tmDatabase.xmlDB_LibraryPath(existingCaption); // TM_Xml_Database.Path_XmlLibraries.pathCombine("{0}.xml".format(guidanceExplorer.library.caption));
                if(existingLibraryPath.fileExists().isFalse())
                    "[xmlDB_RenameGuidanceExplorer] something is wrong since existingLibraryPath was not there: {0}".error(existingLibraryPath);
                else
                {
                    var newLibraryPath = tmDatabase.xmlDB_LibraryPath(newCaption);
                    if (newLibraryPath.fileExists())
                        "[xmlDB_RenameGuidanceExplorer] there was already a library and/or file with that name, so stopping rename): {0}".error(newLibraryPath);
                    else
                    {

                        var pathToGuidanceItems_Existing = tmDatabase.xmlDB_LibraryPath_GuidanceItems(existingCaption);
                        var pathToGuidanceItems_New = tmDatabase.xmlDB_LibraryPath_GuidanceItems(newCaption);

                        "pathToGuidanceItems_Existing: {0}".error(pathToGuidanceItems_Existing);
                        "pathToGuidanceItems_New: {0}".error(pathToGuidanceItems_New);
                        if(pathToGuidanceItems_Existing.dirExists())
                        {
                            "RENAMING {0}-> {1}".error(pathToGuidanceItems_Existing, pathToGuidanceItems_New);
                            Files.renameFolder(pathToGuidanceItems_Existing,  pathToGuidanceItems_New);
                            tmDatabase.updateGuidanceItems_FileMappings_withNewPath(pathToGuidanceItems_Existing,pathToGuidanceItems_New);
                        }

                        guidanceExplorer.library.caption = newCaption;

                        //xmlDB_LibraryPath_GuidanceItems
                        if (Files.deleteFile(existingLibraryPath).isFalse())
                            "[xmlDB_RenameGuidanceExplorer] could not delete existing library file: {0}".error(existingLibraryPath);
                        else
                        {
                            guidanceExplorer.xmlDB_Save_GuidanceExplorer(tmDatabase);
                            return guidanceExplorer;
                        }
                    }
                    return guidanceExplorer;
                }
            }
            return null;
        }
        public static bool xmlDB_RenameGuidanceExplorer(this TM_Xml_Database tmDatabase, guidanceExplorer guidanceExplorer, string newCaption)
        {
            if (newCaption.isValidGuidanceExplorerName().isFalse())
            {
                "[TM_Xml_Database] [xmlDB_RenameGuidanceExplorer] provided caption didn't pass validation regex".error();
                //throw new Exception("Provided Library name didn't pass validation regex");
            }
            else if(guidanceExplorer.notNull())
            {
                guidanceExplorer.library.caption = newCaption;  // update in memory library name value

                return guidanceExplorer.xmlDB_Save_GuidanceExplorer(tmDatabase);                // save it

                /*if (tmDatabase.usingFileStorage())                // soft try to rename the library (disabled for now)
                {
                    try
                    {
                        var current_LibraryRootFolder = tmDatabase.xmlDB_Path_Library_RootFolder(guidanceExplorer);
                        var new_LibraryRootFolder = tmDatabase.Path_XmlLibraries.pathCombine(newCaption);
                        Files.renameFolder(current_LibraryRootFolder, new_LibraryRootFolder);
                        if (new_LibraryRootFolder.dirExists())
                            tmDatabase.GuidanceExplorers_Paths.add(guidanceExplorer, new_LibraryRootFolder);
                    }
                    catch (Exception ex)
                    {
                        ex.log("[xmlDB_RenameGuidanceExplorer] in trying to rename the library folder");
                    }

                }*/
            }
            return false;
        }
        public static guidanceExplorer xmlDB_RenameGuidanceExplorer(this TM_Xml_Database tmDatabase, guidanceExplorer guidanceExplorer, string newCaption)
        {
            if (newCaption.isValidGuidanceExplorerName().isFalse())
            {
                "[TM_Xml_Database][xmlDB_RenameGuidanceExplorer] provided caption didn't pass validation regex".error();
                throw new Exception("Provided Library name didn't pass validation regex");
            }
            //"[xmlDB_RenameGuidanceExplorer]".info();
            if(guidanceExplorer.notNull())
            {
                if (tmDatabase.UsingFileStorage.isFalse())
                {
                    guidanceExplorer.library.caption = newCaption;									// update in memory library name value
                    return guidanceExplorer;
                }
                var existingCaption = guidanceExplorer.library.caption;
                var existingLibraryPath = tmDatabase.xmlDB_LibraryPath(existingCaption); // TM_Xml_Database.Current.Path_XmlLibraries.pathCombine("{0}.xml".format(guidanceExplorer.library.caption));
                if(existingLibraryPath.fileExists().isFalse())
                    "[xmlDB_RenameGuidanceExplorer] something is wrong since existingLibraryPath was not there: {0}".error(existingLibraryPath);
                else
                {
                    var newLibraryPath = tmDatabase.xmlDB_LibraryPath(newCaption);
                    if (newLibraryPath.fileExists())
                        "[xmlDB_RenameGuidanceExplorer] there was already a library and/or file with that name, so stopping rename): {0}".error(newLibraryPath);
                    else
                    {

                        var pathToGuidanceItems_Existing = tmDatabase.xmlDB_LibraryPath_GuidanceItems(existingCaption);
                        //var pathToGuidanceItems_New = tmDatabase.xmlDB_LibraryPath_GuidanceItems(newCaption);
                        if(pathToGuidanceItems_Existing.dirExists())
                        {
                            //"xmlDB_RenameGuidanceExplorer {0}-> {1}".info(pathToGuidanceItems_Existing, pathToGuidanceItems_New);
                            //Renaming workflow:
                            //Files.deleteFile(existingLibraryPath);                                          // delete original xml library file
                            //Files.renameFolder(pathToGuidanceItems_Existing,  pathToGuidanceItems_New);     // rename folders
                            guidanceExplorer.library.caption = newCaption;									// update in memory library name value

                            guidanceExplorer.xmlDB_Save_GuidanceExplorer(tmDatabase);                       // save into new path
                            //tmDatabase.updateGuidanceItems_FileMappings_withNewPath(pathToGuidanceItems_Existing,pathToGuidanceItems_New);  //update article's cache mappings
                            return guidanceExplorer;
                        }
                        "[xmlDB_RenameGuidanceExplorer] could find dir with library to rename".error(
                            pathToGuidanceItems_Existing);
                    }
                }
            }
            return null;
        }