code: public boolean addUserToTeam(final UserPrincipal user, final Team team) {
          List<Team> teams = user.getTeams();
          boolean found = false;
          if (teams == null) {
              teams = new ArrayList<>();
          }
          for (final Team t: teams) {
              if (team.getUuid().equals(t.getUuid())) {
                  found = true;
              }
          }
          if (!found) {
              pm.currentTransaction().begin();
              teams.add(team);
              user.setTeams(teams);
              pm.currentTransaction().commit();
              return true;
          }
          return false;
      }
docs: Associates a UserPrincipal to a Team.
  @param user The user to bind
  @param team The team to bind
  @return true if operation was successful, false if not. This is not an indication of team association,
  an unsuccessful return value may be due to the team or user not existing, or a binding that already
  exists between the two.
  @since 1.0.0