public void setTaskState(@NotNull Task task, @NotNull CustomTaskState state) throws Exception {
    if (state.isPredefined()) {
      //noinspection ConstantConditions
      setTaskState(task, state.asPredefined());
    }
  }
public void setTaskState(@NotNull Task task, @NotNull CustomTaskState state)