//public static void RenameDatabase(string newDatabaseName, int databaseIndex)
        //{
        //    RenameDatabase(newDatabaseName, GetDatabase(databaseIndex).Name);
        //}


        public static void RemoveDatabase(Database database)
        {
            string path = DatabaseUtilities.GetDatabasePath(database.Name);

            AssetDatabase.DeleteAsset(path);
            AssetDatabase.Refresh();
        }
        public static void RenameDatabase(string newDatabaseName, Database database)
        {
            AssetDatabase.RenameAsset(DatabaseUtilities.GetDatabasePath(database.Name), newDatabaseName);

            database.Name = newDatabaseName;

            AssetDatabase.Refresh();
        }
        public static void CreateNewDatabase(DatabaseSettings settings)
        {
            Database database = ScriptableObject.CreateInstance <Database>();

            database.Settings = settings;

            string assetPath = DatabaseUtilities.GetDatabasePath(database.Name);

            //Handle existing databases
            AssetDatabase.DeleteAsset(assetPath);
            AssetDatabase.Refresh();

            AssetDatabase.CreateAsset(database, assetPath);

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
        public static void CreateDatabaseEnum(Database database, DatabaseSettings otherSettings = null)
        {
            string path = DatabaseUtilities.GetEnumPath(database.Name);

            if (!string.IsNullOrEmpty(database.EnumPath) && path != database.EnumPath)
            {
                RemoveDatabaseEnum(database);
            }

            string name;

            string[] entries;
            int[]    indecies;

            PrepareEnumValues(database, out name, out entries, out indecies, otherSettings);

            EnumGenerator.WriteEnum(name, path, entries, indecies);

            database.EnumPath     = path;
            database.EnumTypeName = name; //Connects the generated Enum with the Database
        }