class PublishDelegate {

    Map<String, String> createAttributesFrom(PublishEventTO publishEventTO) {
        Map<String, String> attributes = new HashMap<String, String>();
        attributes.put(Attribute.EVENT_TYPE.name(), publishEventTO.getEvenType().name());
        attributes.put(Attribute.CREATOR_USERNAME.name(), publishEventTO.getCreator().getName());
        attributes.put(Attribute.CREATOR_FIRST_LAST_NAME.name(), publishEventTO.getCreatorsFirstLastName());
        attributes.put(Attribute.SOURCE_ENTRY_ID.name(), String.valueOf(publishEventTO.getSourceEntryId()));
        if (publishEventTO.getContextTitle() != null) {
            attributes.put(Attribute.CONTEXT_TITLE.name(), publishEventTO.getContextTitle());
        }
        if (publishEventTO.getSourceTitle() != null) {
            attributes.put(Attribute.SOURCE_TITLE.name(), publishEventTO.getSourceTitle());
        }
        if (publishEventTO.getSourceEntryTitle() != null) {
            attributes.put(Attribute.SOURCE_ENTRY_TITLE.name(), publishEventTO.getSourceEntryTitle());
        }
        return attributes;
    }

}