public List <DatasetValidateResult> UploadDataset(Dataset dataset, MemoryStream archiveStream) { var datasetArchive = archiveStream != null ? new DatasetArchive(archiveStream) : null; var datasetValidateProcessor = _datasetValidateProcessorFactory.Create(dataset, datasetArchive); if (!datasetValidateProcessor.IsValid) { var errors = datasetValidateProcessor.GetErrors(); return(errors); } var filename = _archiveRepository.GenerateUniqueName(); dataset.ArchiveRepositoryName = filename; _repository.Create(dataset); _archiveRepository.Save(filename, archiveStream); return(new List <DatasetValidateResult>()); }