@Name("email") @Required(false) String email) throws Exception {
// remove any existing registration
unregister(agent, email);
// create a new registration
Registration registration = new Registration();
registration.setDirectoryAgent(getFirstUrl());
registration.setAgent(agent);
registration.setType(type);
registration.setUsername(username);
registration.setEmail(email);
// store the registration
ObjectDatastore datastore = new AnnotationObjectDatastore();
datastore.store(registration);