/**
   * Save the signup form.
   *
   * @param signup
   * @param ipAddress
   */
  public Signup saveSignup(Signup signup, String ipAddress) {
    Identity identity = identityRepository.findByPrincipal(signup.getPrincipal());

    if (identity == null) {
      identity = identityRepository.saveAndFlush(signup.createIdentityFromForm());
      logger.info("New identity {} created", identity.getPrincipal());
    }
    // TODO save the ipAddress
    return signupRepository.saveAndFlush(signup);
  }
 /**
  * True if all existing users for the identity are valid, otherwise admin is notified, except if
  * principal is empty.
  *
  * @param contextId
  * @param principal
  */
 public boolean notifyAdminIfUserIsNotValid(Integer contextId, String principal) {
   if (principal != null && principal.length() > 0) {
     Identity identity = identityRepository.findByPrincipal(principal);
     Signup signup = new Signup(contextId, principal);
     if (identity != null) {
       signup.setFirstName(identity.getIdentityFirstName());
     }
     return allUsersForIdentityAreValid(signup);
   }
   return false;
 }
 public ParticipantReadAdapter build(Report report, Identity identity) {
   if (adaptee == null) {
     throw new RuntimeException("Null participant cannot be persisted.");
   }
   // TODO verify participant.getStaffMember().getId()
   return new ParticipantReadAdapter(
       adaptee.getId(),
       report.getId(),
       identity.getId(),
       identity.getIdentityFirstName(),
       identity.getIdentityLastName(),
       identity.getDisplayName(),
       adaptee.getAssignmentType(),
       adaptee.getStaffMember().getId());
 }