code: private void fillBuildTaskSet(
              BuildSetTask buildSetTask,
              User user,
              Supplier<Integer> buildTaskIdProvider,
              ProductMilestone productMilestone,
              Set<BuildConfigurationAudited> toBuild,
              Set<BuildTask> alreadySubmittedBuildTasks,
              BuildOptions buildOptions) {
          for (BuildConfigurationAudited buildConfigAudited : toBuild) {
              Optional<BuildTask> taskOptional = alreadySubmittedBuildTasks.stream()
                      .filter(bt -> bt.getBuildConfigurationAudited().equals(buildConfigAudited))
                      .findAny();
  
              BuildTask buildTask;
              if (taskOptional.isPresent()) {
                  buildTask = taskOptional.get();
                  log.debug("Linking BuildConfigurationAudited {} to existing task {}.", buildConfigAudited, buildTask);
              } else {
                  int buildId = buildTaskIdProvider.get();
                  String buildContentId = ContentIdentityManager.getBuildContentId(buildId);
                  MDCUtils.addBuildContext(buildContentId, buildOptions.isTemporaryBuild(), temporaryBuildExpireDate);
  
                  buildTask = BuildTask.build(
                          buildConfigAudited,
                          buildSetTask.getBuildOptions(),
                          user,
                          buildId,
                          buildSetTask,
                          buildSetTask.getStartTime(),
                          productMilestone,
                          buildContentId);
                  log.debug("Created new buildTask {} for BuildConfigurationAudited {}.", buildTask, buildConfigAudited);
              }
  
              buildSetTask.addBuildTask(buildTask);
          }
  
          // Loop again to set dependencies
          for (BuildTask buildTask : buildSetTask.getBuildTasks()) {
              for (BuildTask checkDepBuildTask : buildSetTask.getBuildTasks()) {
                  if (buildTask.hasDirectConfigDependencyOn(checkDepBuildTask)) {
                      buildTask.addDependency(checkDepBuildTask);
                  }
              }
          }
      }
docs: Creates build tasks and sets up the appropriate dependency relations
  
  @param buildSetTask The build set task which will contain the build tasks.  This must already have
  initialized the BuildConfigSet, BuildConfigSetRecord, Milestone, etc.