public ExternalAccountView getExternalAccountView(
      Viewpoint viewpoint, ExternalAccount externalAccount) {
    ExternalAccountView view;
    if (externalAccount.getAccountType() == ExternalAccountType.FACEBOOK) {
      view =
          new ExternalAccountView(externalAccount, facebookSystem.getProfileLink(externalAccount));
    } else {
      view = new ExternalAccountView(externalAccount);
    }

    loadThumbnails(viewpoint, view);

    return view;
  }
  public Set<ExternalAccountView> getExternalAccountViews(Viewpoint viewpoint, User user) {
    // Right now we ignore the viewpoint, so this method is pretty pointless.
    // but if people use it, future code will work properly.

    // be sure the account is attached... the external accounts are lazy-loaded
    if (!em.contains(user.getAccount()))
      throw new RuntimeException("detached account in getExternalAccounts()");

    Set<ExternalAccount> accounts = user.getAccount().getExternalAccounts();
    // logger.debug("{} external accounts for user {}", accounts.size(), user);

    Set<ExternalAccountView> accountViews = new HashSet<ExternalAccountView>();
    for (ExternalAccount account : accounts) {
      if (account.getAccountType() == ExternalAccountType.FACEBOOK) {
        accountViews.add(new ExternalAccountView(account, facebookSystem.getProfileLink(account)));
      } else {
        accountViews.add(new ExternalAccountView(account));
      }
    }

    return accountViews;
  }