         } else {
             cell = collectionView.dequeueReusableCellWithReuseIdentifier(PhotoCollectionViewCell.cellIdentifier(), forIndexPath: indexPath) as! PhotoCollectionViewCell
         }
-
+        
         cell.delegate = self
         return cell
     }
-
+    
     func collectionViewCellDidTapDelete(cell: PhotoCollectionViewCell) {
         if let indexPath = collectionView.indexPathForCell(cell) {
             self.deleteAssetAtIndex(indexPath.item, handler: {

            })
        }
    }

    func libraryAuthorizationStatus() -> ALAuthorizationStatus {
        return ALAssetsLibrary.authorizationStatus()
    }

    func cameraAuthorizationStatus() -> AVAuthorizationStatus {
        return captureManager.authorizationStatus()
    }

    // MARK: - Actions

    func flashButtonTapped(sender: UIButton) {
        let mode = captureManager.nextAvailableFlashMode() ?? .Off
        captureManager.changeFlashMode(mode) {

            }, completion: { cancelled in
                self.dismissViewControllerAnimated(true, completion: nil)
        })
        
        presentViewController(controller, animated: true, completion: nil)
    }
    
    func capturePhotoTapped(sender: UIButton) {
        sender.enabled = false
        UIView.animateWithDuration(0.1, animations: { self.previewView.alpha = 0.0 }, completion: { finished in
            UIView.animateWithDuration(0.1, animations: {self.previewView.alpha = 1.0})
        })
        
        captureManager.captureImage { (data, metadata) in
            sender.enabled = true
            
            self.createAssetFromImageData(data, completion: self.didAddAsset)
        }
    }
    
    private func didAddAsset(asset: Asset) {
        collectionView.performBatchUpdates({
            self.delegate?.photoCaptureViewController(self, didAddAsset: asset)
