protected void notifyEvent(
      CoreSession session,
      String eventId,
      Map<String, Serializable> properties,
      String comment,
      String category,
      DocumentModel dm) {

    // Default category
    if (category == null) {
      category = DocumentEventCategories.EVENT_DOCUMENT_CATEGORY;
    }

    if (properties == null) {
      properties = new HashMap<String, Serializable>();
    }

    properties.put(CoreEventConstants.REPOSITORY_NAME, session.getRepositoryName());
    properties.put(CoreEventConstants.SESSION_ID, session.getSessionId());
    properties.put(CoreEventConstants.DOC_LIFE_CYCLE, dm.getCurrentLifeCycleState());

    DocumentEventContext ctx = new DocumentEventContext(session, session.getPrincipal(), dm);

    ctx.setProperties(properties);
    ctx.setComment(comment);
    ctx.setCategory(category);

    EventProducer evtProducer = Framework.getService(EventProducer.class);
    Event event = ctx.newEvent(eventId);
    evtProducer.fireEvent(event);
  }