private void validate() throws ValidationError {

        List<WorkflowTask> allTasks = new ArrayList<>();
        for (Task task : tasks) {
            List<WorkflowTask> workflowDefTasks = task.getWorkflowDefTasks();
            for (WorkflowTask workflowDefTask : workflowDefTasks) {
                allTasks.addAll(workflowDefTask.collectTasks());
            }
        }

        Map<String, WorkflowTask> taskMap = new HashMap<>();
        Set<String> duplicateTasks = new HashSet<>();
        for (WorkflowTask task : allTasks) {
            if (taskMap.containsKey(task.getTaskReferenceName())) {
                duplicateTasks.add(task.getTaskReferenceName());
            } else {
                taskMap.put(task.getTaskReferenceName(), task);
            }
        }
        if (!duplicateTasks.isEmpty()) {
            throw new ValidationError(
                    "Task Reference Names MUST be unique across all the tasks in the workkflow.  "
                            + "Please update/change reference names to be unique for the following tasks: "
                            + duplicateTasks);
        }
    }
Validate: 1. There are no tasks with duplicate reference names 2. Each of the task is
consistent with its definition 3.
java-sdk/src/main/java/com/netflix/conductor/sdk/workflow/def/WorkflowBuilder.java