protected void TransitTo(TaskState newState)
 {
     if (state.IsValidTransition(newState))
     {
         log.LogInformation($"{logPrefix}Task {Id} state transition from {state} to {newState}");
         state = newState;
     }
     else
     {
         throw new IllegalStateException($"Invalid transition from {state} to {newState}");
     }
 }