     }
     
     func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
-        self.selectedInvitation = liveInvitations[indexPath.row]
+        switch indexPath.section {
+        case 0:
+            self.selectedInvitation = liveInvitations[indexPath.row]
+        case 1:
+            self.selectedInvitation = pastInvitations[indexPath.row]
+        default:
+            break
+        }
+        performSegueWithIdentifier("AlbumDetailSegue", sender: self)
     }
     
     override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

    
    private var refreshControl : UIRefreshControl!
    private var liveInvitations : [Invitation] = []
    private var selectedInvitation : Invitation?
    private var searchBar: UISearchBar!
    


extension AlbumGeneralViewController : UITableViewDataSource {
    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        if liveInvitations.count > 0 || pastInvitations.count > 0 {
            return 2
        } else {
            return 1
        }
    }
    
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if liveInvitations.count > 0 || pastInvitations.count > 0 {
            switch section {
            case 0:
                return liveInvitations.count
            case 1:
                return pastInvitations.count
            default:
                return 0
            }
        } else {
            return 1
        }
    }
    
    func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        if liveInvitations.count > 0 || pastInvitations.count > 0 {
            switch section {
            case 0:
                return "Live Events"
            case 1:
                return "Past Events"
            default:
                return ""
            }
        } else {
            return ""
        }
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        if liveInvitations.count > 0 || pastInvitations.count > 0 {
            let cell = tableView.dequeueReusableCellWithIdentifier("AlbumGeneralViewCell", forIndexPath: indexPath) as! AlbumGeneralViewCell
            switch indexPath.section {
            case 0:
                cell.event = liveInvitations[indexPath.row].event
            case 1:
                cell.event = pastInvitations[indexPath.row].event
            default:
                break
            }
            return cell
        } else {
            let cell = tableView.dequeueReusableCellWithIdentifier(noAlbumsCellReuseIdentifier, forIndexPath: indexPath) as? NoAlbumsCell
            let originalCenter = cell!.arrow.center
            
            UIView.animateWithDuration(0.6, delay: 0.0, options: .Autoreverse | .Repeat | .CurveEaseOut, animations: { () -> Void in
                cell!.arrow.center.y = cell!.arrow.center.y - 10
                }, completion: { (sucees:Bool) -> Void in
                cell!.arrow.center = originalCenter
            })
            
            return cell!
        }
    }
