public void deleteOutput(long taskId, String userId) {
Task task = persistenceContext.findTask(taskId);
long contentId = task.getTaskData().getOutputContentId();
Content content = persistenceContext.findContent(contentId);
Map<String, Object> initialContent = new HashMap<>();
ContentMarshallerContext context = TaskContentRegistry.get().getMarshallerContext(task);
Object unmarshalledObject = ContentMarshallerHelper.unmarshall(content.getContent(), context.getEnvironment(), context.getClassloader());
if(unmarshalledObject != null && unmarshalledObject instanceof Map){
initialContent.putAll((Map<String, Object>)unmarshalledObject);
}
taskEventSupport.fireBeforeTaskOutputVariablesChanged(task, this.context, initialContent);
ContentData data = TaskModelProvider.getFactory().newContentData();
persistenceContext.removeContent(content);
persistenceContext.setOutputToTask(null, data, task);
taskEventSupport.fireAfterTaskOutputVariablesChanged(task, this.context, null);
}