private List<VerifiableEmail> getEmailIdentities(RegistrationRequestState currentRequest)
     throws EngineException {
   List<VerifiableEmail> emailIds = new ArrayList<>();
   List<IdentityParam> identities = currentRequest.getRequest().getIdentities();
   if (identities == null) return emailIds;
   for (IdentityParam id : identities)
     if (id != null && id.getTypeId().equals(EmailIdentity.ID))
       emailIds.add(EmailIdentity.fromIdentityParam(id));
   return emailIds;
 }
 private Attribute<?> getEmailAttributeFromRequest(
     RegistrationRequestState currentRequest, SqlSession sql) throws EngineException {
   List<Attribute<?>> attrs = currentRequest.getRequest().getAttributes();
   if (attrs == null) return null;
   AttributeType at =
       attributesHelper.getAttributeTypeWithSingeltonMetadata(
           ContactEmailMetadataProvider.NAME, sql);
   if (at == null) return null;
   for (Attribute<?> ap : attrs) {
     if (ap == null) continue;
     if (ap.getName().equals(at.getName()) && ap.getGroupPath().equals("/")) return ap;
   }
   return null;
 }