code: public ApiKey createApiKey(final Team team) {
          final List<Team> teams = new ArrayList<>();
          teams.add(team);
          pm.currentTransaction().begin();
          final ApiKey apiKey = new ApiKey();
          apiKey.setKey(ApiKeyGenerator.generate());
          apiKey.setTeams(teams);
          pm.makePersistent(apiKey);
          pm.currentTransaction().commit();
          return pm.getObjectById(ApiKey.class, apiKey.getId());
      }
docs: Creates a new ApiKey object, including a cryptographically secure
  API key string.
  @param team The team to create the key for
  @return an ApiKey