         
         let videoURL = getDocumentUrl(videoName)
         let creationDate = selectedAsset?.creationDate
+        let assetId = selectedAsset?.localIdentifier
+        
         selectedAsset = nil
         do {
             try filemgr.copyItemAtURL(avUrlAsset.URL, toURL: videoURL)

        
        let object = NSManagedObject(entity: entity!, insertIntoManagedObjectContext: managedContext)
        
        object.setValue(videoURL.lastPathComponent, forKey: "videoFile")
        object.setValue(thumbnailURL.lastPathComponent, forKey: "thumbFile")
        object.setValue(NSDate(), forKey: "openDate")

                self.tableView.reloadData()
                self.viewVideo(video)
            }
        } catch let error  {
            print("Could not save \(error))")
        }
    }
    
