class EmailValidator implements Validator<String, DuplicateEmailException> {

    @Override
    public void validate(final String email) throws DuplicateEmailException {

        final Optional<Identity> byEmail = findIdentityService.findByEmail(email);

        // TODO - consider an update to the current identity that doesn't actually change anything.

        if (byEmail.isPresent()) {
            throw new DuplicateEmailException();
        }
    }

    public  EmailValidator(final FindIdentityService findIdentityService);

}