private static void fireEventMembersManagement(
SocialWorkspace socialWorkspace, List<Principal> usernames,
String eventName) {
if (socialWorkspace.isMembersNotificationEnabled()) {
DocumentModel doc = socialWorkspace.getDocument();
EventContext ctx = new DocumentEventContext(doc.getCoreSession(),
doc.getCoreSession().getPrincipal(), doc);
ctx.setProperty(CTX_PRINCIPALS_PROPERTY, (Serializable) usernames);
try {
Framework.getLocalService(EventService.class).fireEvent(
ctx.newEvent(eventName));