docs: protected void insertHistoricVariableUpdateEntity(HistoricVariableUpdateEventEntity historyEvent) {
      DbEntityManager dbEntityManager = getDbEntityManager();
  
      // insert update only if history level = FULL
      if(shouldWriteHistoricDetail(historyEvent)) {
  
        // insert byte array entity (if applicable)
        byte[] byteValue = historyEvent.getByteValue();
        if(byteValue != null) {
          ByteArrayEntity byteArrayEntity = new ByteArrayEntity(historyEvent.getVariableName(), byteValue, ResourceTypes.HISTORY);
          byteArrayEntity.setRootProcessInstanceId(historyEvent.getRootProcessInstanceId());
          byteArrayEntity.setRemovalTime(historyEvent.getRemovalTime());
  
          Context
          .getCommandContext()
          .getByteArrayManager()
          .insertByteArray(byteArrayEntity);
          historyEvent.setByteArrayId(byteArrayEntity.getId());
  
        }
        dbEntityManager.insert(historyEvent);
      }
  
      // always insert/update HistoricProcessVariableInstance
      if (historyEvent.isEventOfType(HistoryEventTypes.VARIABLE_INSTANCE_CREATE)) {
        HistoricVariableInstanceEntity persistentObject = new HistoricVariableInstanceEntity(historyEvent);
        dbEntityManager.insert(persistentObject);
  
      } else if (historyEvent.isEventOfType(HistoryEventTypes.VARIABLE_INSTANCE_UPDATE)
          || historyEvent.isEventOfType(HistoryEventTypes.VARIABLE_INSTANCE_MIGRATE)) {
        HistoricVariableInstanceEntity historicVariableInstanceEntity = dbEntityManager.selectById(HistoricVariableInstanceEntity.class, historyEvent.getVariableInstanceId());
        if(historicVariableInstanceEntity != null) {
          historicVariableInstanceEntity.updateFromEvent(historyEvent);
          historicVariableInstanceEntity.setState(HistoricVariableInstance.STATE_CREATED);
  
        } else {
          // #CAM-1344 / #SUPPORT-688
          // this is a FIX for process instances which were started in camunda fox 6.1 and migrated to camunda BPM 7.0.
          // in fox 6.1 the HistoricVariable instances were flushed to the DB when the process instance completed.
          // Since fox 6.2 we populate the HistoricVariable table as we go.
          HistoricVariableInstanceEntity persistentObject = new HistoricVariableInstanceEntity(historyEvent);
          dbEntityManager.insert(persistentObject);
        }
  
      } else if(historyEvent.isEventOfType(HistoryEventTypes.VARIABLE_INSTANCE_DELETE)) {
        HistoricVariableInstanceEntity historicVariableInstanceEntity = dbEntityManager.selectById(HistoricVariableInstanceEntity.class, historyEvent.getVariableInstanceId());
        if(historicVariableInstanceEntity != null) {
          historicVariableInstanceEntity.setState(HistoricVariableInstance.STATE_DELETED);
        }
      }
    }