private MediaItem CreateMediaLibraryItem(Sitecore.Data.Database db, Stream sourceStream, string sourceFile, string documentName, Item destFolder) { var destPath = destFolder.Paths.Path + "/" + documentName; var options = new Sitecore.Resources.Media.MediaCreatorOptions { Database = db, Language = Sitecore.Globalization.Language.Current, Versioned = false, Destination = destPath, FileBased = true }; var creator = new Sitecore.Resources.Media.MediaCreator(); var item = creator.CreateFromStream(sourceStream, sourceFile, options); return item; }