order.calculateAndSetTotalHours();
checkConstraintOrderUniqueCode(order);
checkConstraintHoursGroupUniqueCode(order);
state.synchronizeTrees();
TaskGroup rootTask = state.getRootTask();
if (rootTask != null) {
// This reattachment is needed to ensure that the root task in
// the state is the one associated to the transaction's session.
// Otherwise if some order element has been removed, when doing