private void handleProfileMimeType(byte[] payload) {
    UUID profileUuid = NFCProfileUtils.toUUID(payload);
    Profile currentProfile = mProfileManager.getActiveProfile();

    if (currentProfile == null || !currentProfile.getUuid().equals(profileUuid)) {
      saveCurrentProfile();
      switchTo(profileUuid);
    } else if (currentProfile.getUuid().equals(profileUuid)) {
      Profile lastProfile = getPreviouslySelectedProfile();
      if (lastProfile != null) {
        switchTo(lastProfile.getUuid());
        clearPreviouslySelectedProfile();
      }
    }
  }
 private void saveCurrentProfile() {
   Profile currentProfile = mProfileManager.getActiveProfile();
   SharedPreferences.Editor editor = getSharedPreferences(PREFS_NAME, 0).edit();
   editor.putString(PREFS_PREVIOUS_PROFILE, currentProfile.getUuid().toString());
   editor.commit();
 }