//--- remove any previously harvested metadata/sub-templates
deleteExistingMetadata(getUri(ds));
//--- Create metadata/subtemplates from fragments
FragmentHarvester fragmentHarvester = ds.hasNestedDatasets() ? collectionFragmentHarvester : atomicFragmentHarvester;
HarvestSummary fragmentResult = fragmentHarvester.harvest(fragments, getUri(ds));
//--- Include fragment results in thredds results
result.fragmentsReturned += fragmentResult.fragmentsReturned;
result.fragmentsUnknownSchema += fragmentResult.fragmentsUnknownSchema;
result.subtemplatesAdded += fragmentResult.fragmentsAdded;