// Cleanup members list, to remove affected user
for (Principal principal : principals) {
members.remove(principal.getName());
}
UserManager userManager = Framework.getLocalService(UserManager.class);
for (String username : members) {
try {
String email = userManager.getPrincipal(username).getEmail();
if (!StringUtils.isBlank(email)) {
emails.add(email);
}
} catch (ClientException e) {
log.info(String.format("Trying to fetch an unknown user: %s",