throw new IllegalStateException("Username cannot be changed.");
}
if (newUsername != null && !newUsername.isEmpty()) {
if (!USER_NAME_PATTERN.matcher(newUsername).matches()) {
throw new InvalidUserNameException();
}
final AccountExternalId.Key key =
new AccountExternalId.Key(SCHEME_USERNAME, newUsername);
try {