dbEntityManager.insert(historyEvent);
} else {
if(dbEntityManager.getCachedEntity(historyEvent.getClass(), historyEvent.getId()) == null) {
if (historyEvent instanceof HistoricScopeInstanceEvent) {
// if this is a scope, get start time from existing event in DB
HistoricScopeInstanceEvent existingEvent = (HistoricScopeInstanceEvent) dbEntityManager.selectById(historyEvent.getClass(), historyEvent.getId());
if(existingEvent != null) {
HistoricScopeInstanceEvent historicScopeInstanceEvent = (HistoricScopeInstanceEvent) historyEvent;
historicScopeInstanceEvent.setStartTime(existingEvent.getStartTime());
}
}
if(historyEvent.getId() == null) {
// dbSqlSession.insert(historyEvent);
} else {