private void populateVersionForSubWorkflow(WorkflowTask workflowTask) {
        Utils.checkNotNull(workflowTask, "WorkflowTask cannot be null");
        SubWorkflowParams subworkflowParams = workflowTask.getSubWorkflowParam();
        if (subworkflowParams.getVersion() == null) {
            String subWorkflowName = subworkflowParams.getName();
            Integer subWorkflowVersion =
                    metadataDAO
                            .getLatestWorkflowDef(subWorkflowName)
                            .map(WorkflowDef::getVersion)
                            .orElseThrow(
                                    () -> {
                                        String reason =
                                                String.format(
                                                        "The Task %s defined as a sub-workflow has no workflow definition available ",
                                                        subWorkflowName);
                                        LOGGER.error(reason);
                                        return new TerminateWorkflowException(reason);
                                    });
            subworkflowParams.setVersion(subWorkflowVersion);
        }
    }
Populates metadata definitions within workflow objects. Benefits of loading and populating
metadata definitions upfront could be:

<ul>
  <li>Immutable definitions within a workflow execution with the added benefit of guaranteeing
      consistency at runtime.
  <li>Stress is reduced on the storage layer
</ul>
core/src/main/java/com/netflix/conductor/core/metadata/MetadataMapperService.java