public void profileChanged(CustomProfile profile) {
    if (!profile.isSharedProfile()) {
      updateProfilesWithName(profile.getID(), profile, true);
    }

    notifyObservers(SETTINGS_CHANGED_EVENT);
  }
  public void profileRenamed(CustomProfile profile, String oldID) {
    fProfiles.remove(oldID);
    fProfiles.put(profile.getID(), profile);

    if (!profile.isSharedProfile()) {
      updateProfilesWithName(oldID, profile, false);
    }

    Collections.sort(fProfilesByName);
    notifyObservers(PROFILE_RENAMED_EVENT);
  }
  public void profileReplaced(CustomProfile oldProfile, CustomProfile newProfile) {
    fProfiles.remove(oldProfile.getID());
    fProfiles.put(newProfile.getID(), newProfile);
    fProfilesByName.remove(oldProfile);
    fProfilesByName.add(newProfile);
    Collections.sort(fProfilesByName);

    if (!oldProfile.isSharedProfile()) {
      updateProfilesWithName(oldProfile.getID(), null, false);
    }

    setSelected(newProfile);
    notifyObservers(PROFILE_CREATED_EVENT);
    notifyObservers(SELECTION_CHANGED_EVENT);
  }
  public boolean deleteProfile(CustomProfile profile) {
    int index = fProfilesByName.indexOf(profile);

    fProfiles.remove(profile.getID());
    fProfilesByName.remove(profile);

    profile.setManager(null);

    if (index >= fProfilesByName.size()) index--;
    fSelected = fProfilesByName.get(index);

    if (!profile.isSharedProfile()) {
      updateProfilesWithName(profile.getID(), null, false);
    }

    notifyObservers(PROFILE_DELETED_EVENT);
    return true;
  }