         
         assetGroup.group.enumerateAssetsUsingBlock {[unowned self](result: ALAsset!, index: Int, stop: UnsafeMutablePointer<ObjCBool>) in
             if result != nil {
-                self.images.addObject(UIImage(CGImage:result.thumbnail().takeUnretainedValue()))
+                let asset = DKAsset()
+                asset.thumbnailImage = UIImage(CGImage:result.thumbnail().takeUnretainedValue())
+                asset.url = result.valueForProperty(ALAssetPropertyAssetURL) as? NSURL
+                self.imageAssets.addObject(asset)
             } else {
                 self.collectionView!.reloadData()
                 dispatch_async(dispatch_get_main_queue()) {
-                    self.collectionView!.scrollToItemAtIndexPath(NSIndexPath(forRow: self.images.count-1, inSection: 0),
+                    self.collectionView!.scrollToItemAtIndexPath(NSIndexPath(forRow: self.imageAssets.count-1, inSection: 0),
                         atScrollPosition: UICollectionViewScrollPosition.Bottom,
                         animated: false)
                 }

    }
    
    override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
        let cell = collectionView.cellForItemAtIndexPath(indexPath) as DKImageCollectionCell
        NSNotificationCenter.defaultCenter().postNotificationName(DKImageSelectedNotification, object: cell.thumbnail)
    }
    
    override func collectionView(collectionView: UICollectionView, didDeselectItemAtIndexPath indexPath: NSIndexPath) {
        let cell = collectionView.cellForItemAtIndexPath(indexPath) as DKImageCollectionCell
        NSNotificationCenter.defaultCenter().postNotificationName(DKImageUnselectedNotification, object: cell.thumbnail)
    }
}

class DKAssetsLibraryController: UITableViewController {
    weak var delegate: DKImagePickerControllerDelegate?
    
    lazy var groups: NSMutableArray = {
        return NSMutableArray()

    }
    
    var assetGroup: DKAssetGroup!
    private lazy var imageAssets: NSMutableArray = {
        return NSMutableArray()
    }()
    
