function saveGUIState(guiState, defaultToolboxName, defaultThemeName) {
  // Don't save toolbox and theme, as we'll save their names instead.
  delete guiState.options['toolbox'];
  delete guiState.options['theme'];

  if (guiState.debugEnabled) {
    // In this case guiState.options.renderer is 'debugRenderer'. Storing this
    // is not helpful, so instead store the actual name of the renderer.
    guiState.options.renderer = guiState.renderer;
  }

  // Save GUI control options to local storage.
  const guiStateKey = `guiState_${id}`;
  localStorage.setItem(guiStateKey, JSON.stringify(guiState));

  // Save GUI state into the URL:
  const hashGuiState = Object.assign({}, guiState.options);
  if (guiState.toolboxName !== defaultToolboxName) {
    hashGuiState.toolbox = guiState.toolboxName;
  }
  if (guiState.themeName !== defaultThemeName) {
    hashGuiState.theme = guiState.themeName;
  }

  // Save whether the debug is enabled.
  hashGuiState.debugEnabled = guiState.debugEnabled;
  window.location.hash = HashState.save(hashGuiState);
}
Save the GUI state to local storage and the window hash.
@param {Object} guiState The GUI State.
@param {string} defaultToolboxName The default toolbox name.
@param {string} defaultThemeName The default theme name.