public ISupportingFile CreateSupportingFile(string fileName, string fileNameUniqueToken, Stream s) { string storagePath = _fileStorage.CreateFile(fileName); using (Stream outStream = new FileStream(storagePath, FileMode.OpenOrCreate, FileAccess.Write)) StreamHelper.Transfer(s, outStream); SupportingFileFactory fileFactory = new SupportingFileFactory(this, Guid.NewGuid().ToString(), fileName, 1); _factoriesById[fileFactory.FileId] = fileFactory; ISupportingFile file = fileFactory.CreateSupportingFile(new Uri(UrlHelper.CreateUrlFromPath(storagePath)), fileName, fileNameUniqueToken, true); return(file); }