AccountExternalId extId = db.accountExternalIds().get(key);
if (extId != null) {
if (!extId.getAccountId().equals(from)) {
throw new AccountException("Identity in use by another account");
}
db.accountExternalIds().delete(Collections.singleton(extId));
if (who.getEmailAddress() != null) {
final Account a = db.accounts().get(from);
if (a.getPreferredEmail() != null
&& a.getPreferredEmail().equals(who.getEmailAddress())) {