         }
         else
         {
-            let selection = playlistArrayController.selectedObjects.first as! NSDictionaryControllerKeyValuePair
+            let selection = playlistArrayController.selectedObjects.first as! PlayList
             let objects: [PlayItem] = playitemArrayController.arrangedObjects as! [PlayItem]
-            let name = String(format: "%@+%ld", selection.key!, indexSet.count)
+            let name = String(format: "%@+%ld", selection.name, indexSet.count)
             var items: [AnyObject] = [AnyObject]()
 
             for index in indexSet {

        }
    }

    var historyCache: NSDictionaryControllerKeyValuePair? = nil
    override func viewWillAppear() {
        // add existing history entry if any AVQueuePlayer
        if historyCache == nil {
            historyCache = playlistArrayController.newObject() as NSDictionaryControllerKeyValuePair
            historyCache!.key = UserSettings.HistoryName.value
            historyCache!.value = [PlayItem]()
        }
        
        if appDelegate.histories.count > 0 {
            playlists[UserSettings.HistoryName.value] = nil
            
            // overlay in history using NSDictionaryControllerKeyValuePair Protocol setKey
            historyCache = playlistArrayController.newObject() as NSDictionaryControllerKeyValuePair
            historyCache!.key = UserSettings.HistoryName.value
            historyCache!.value = appDelegate.histories
        }
        playlistArrayController.addObject(historyCache!)
        
        // cache our list before editing
        playCache = playlists


class PlaylistViewController: NSViewController,NSTableViewDataSource,NSTableViewDelegate,NSMenuDelegate {

    @IBOutlet var playlistArrayController: NSArrayController!
    @IBOutlet var playitemArrayController: NSArrayController!

    @IBOutlet var playlistTableView: PlayTableView!
