code: public static List<WorkUnit> flattenWorkUnits(Collection<WorkUnit> workUnits) {
      List<WorkUnit> flattenedWorkUnits = Lists.newArrayList();
      for (WorkUnit workUnit : workUnits) {
        if (workUnit instanceof MultiWorkUnit) {
          flattenedWorkUnits.addAll(flattenWorkUnits(((MultiWorkUnit) workUnit).getWorkUnits()));
        } else {
          flattenedWorkUnits.add(workUnit);
        }
      }
      return flattenedWorkUnits;
    }
docs: Utility method that takes in a {@link List} of {@link WorkUnit}s, and flattens them. It builds up
  the flattened list by checking each element of the given list, and seeing if it is an instance of
  {@link MultiWorkUnit}. If it is then it calls itself on the {@link WorkUnit}s returned by
  {@link MultiWorkUnit#getWorkUnits()}. If not, then it simply adds the {@link WorkUnit} to the
  flattened list.
  
  @param workUnits is a {@link List} containing either {@link WorkUnit}s or {@link MultiWorkUnit}s
  @return a {@link List} of flattened {@link WorkUnit}s