public SettingsData LoadSettings(string settingName)
        {
            SettingsData settings = null;
                object settingsObj = UserSettings.RestoreObject(SettingsFileName);
                if (settingsObj is SettingsData)
                    settings = (SettingsData)settingsObj;
                else if (settingsObj is Dictionary<string, SettingsData>){
                    SettingDataDict = (Dictionary<string, SettingsData>)settingsObj;
                    try{
                        if (SettingDataDict.ContainsKey(settingName))
                            settings = SettingDataDict[settingName];
                        else //if the dictionary has only 1 key, get the first saved key.
                        {
                            if (SettingDataDict.Values.Count== 1){
                                foreach (string keyName in SettingDataDict.Keys ) {
                                    settingName = keyName; //the setting name passed in was not found, so loading the only session which exists
                                    //todo optimize getting session by name.
                                    settings = SettingDataDict[settingName];
                                }
                            }

                        }

                    }
                    catch(KeyNotFoundException ex){
                        throw ex;
                    }
                }
            // if nothing loaded, initialise with default settings
            if (settings==null)
                settings = new SettingsData();

            return settings;
        }
        /// <summary>Saves the settings after getting them from the saved location and replacing the current key with the updated version from the current session
        /// </summary>
        public static void SaveSettings(SettingsData sd)
        {
            object SavedSettings = UserSettings.RestoreObject(SettingsFileName);
            if (SettingDataDict == null) SettingDataDict = new Dictionary<string, SettingsData>();
            if (SavedSettings is SettingsData){ //in case what's saved is
                SettingsData settings = (SettingsData)SavedSettings;
                SettingDataDict[settings.SettingName] = settings; //resurrect saved settings and add current settings to it.
                SettingDataDict[sd.SettingName] = sd; //add current item to list
            }
            else if (SavedSettings is Dictionary<string, SettingsData>){
                SettingDataDict = (Dictionary<string, SettingsData>)SavedSettings;
                SettingDataDict[sd.SettingName] = sd;
            }

            if (SettingDataDict == null) SettingDataDict = new Dictionary<string, SettingsData>();
            SettingDataDict[sd.SettingName] = sd;
            SaveSettings(SettingDataDict);
        }