     }
     
     static let ioQueue = DispatchQueue(label: "DKPhotoImagePreviewVC.ioQueue")
-    
-    private func exportAsset(with asset: DKAsset, progress: @escaping (Double) -> Void, completion: @escaping (Error?) -> Void) {
+
+    private func exportAsset(with asset: DKAsset, requestID: DKImageAssetExportRequestID, progress: @escaping (Double) -> Void, completion: @escaping (Error?) -> Void) {
         switch asset.type {
         case .photo:
-            self.exportImage(with: asset, progress: progress, completion: completion)
+            self.exportImage(with: asset, requestID: requestID, progress: progress, completion: completion)
         case .video:
-            self.exportAVAsset(with: asset, progress: progress, completion: completion)
-        }
-    }
-    
-    private func exportImage(with asset: DKAsset, progress: @escaping (Double) -> Void, completion: @escaping (Error?) -> Void) {
+            self.exportAVAsset(with: asset, requestID: requestID, progress: progress, completion: completion)
+        }
+    }
+    
+    private func exportImage(with asset: DKAsset, requestID: DKImageAssetExportRequestID, progress: @escaping (Double) -> Void, completion: @escaping (Error?) -> Void) {
+        
+        func write(data: Data, to url: URL) throws {
+            let (auxiliaryDirectory, auxiliaryFilePath) = self.generateAuxiliaryPath(with: url)
+            
+            let fileManager = FileManager.default
+            try fileManager.createDirectory(at: auxiliaryDirectory, withIntermediateDirectories: true, attributes: nil)
+            
+            try data.write(to: auxiliaryFilePath, options: [.atomic])
+            try fileManager.moveItem(at: auxiliaryFilePath, to: url)
+            try fileManager.removeItem(at: auxiliaryDirectory)
+        }
+        
         if let _ = asset.originalAsset {
             autoreleasepool {
                 let options = PHImageRequestOptions()

                            default:
                                assert(false)
                            }
                            
                            try? fileManager.removeItem(at: tempFile)
                        })
                        
                        self.currentAVExportSession = exportSession
                        
                        self.waitForExportToFinish(exportSession: exportSession, group: group) { p in
                            progress(p)
                        }
                    } else {
                        if let info = info, let isCancelled = info[PHImageCancelledKey] as? NSNumber, isCancelled.boolValue {

                asset.error = nil
                
                if let localTemporaryPath = asset.localTemporaryPath,
                    let subpaths = try? FileManager.default.contentsOfDirectory(at: localTemporaryPath,
                                                                                includingPropertiesForKeys: [],
                                                                                options: .skipsHiddenFiles),
                    subpaths.count > 0 {
                    asset.localTemporaryPath = subpaths[0]
                    asset.fileName = subpaths[0].lastPathComponent
                    exportCompletionBlock(asset, nil)
                    continue
                }
                
                self.exportAsset(with: asset, requestID: requestID, progress: { progress in
                    asset.progress = progress
                    
                    self.notify(with: #selector(DKImageAssetExporterObserver.exporterDidUpdateProgress(exporter:asset:)), object: self, objectTwo: asset)
