     
     override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! CalendarCell
-        cell.eventDateLabel.text = getDateFormatter().string(from: events[indexPath.row].startDate)
-        cell.locationLabel.text = events[indexPath.row].location
+        let event = events[indexPath.row]
+        print("Event identifier \(event.eventIdentifier)")
+        cell.eventDateLabel.text = getDateFormatter().string(from: event.startDate)
+        cell.locationLabel.text = event.location
         return cell
     }
     

        let endDate = dateFormatter.date(from: "2016-12-31")
        let calenderIdentifier = self.userDefaults.string(forKey: "EventTrackerPrimaryCalendar")
        let calendar = self.eventStore.calendar(withIdentifier: calenderIdentifier!)
        let eventPredicate = eventStore.predicateForEvents(withStart: startDate!, end: endDate!, calendars: [calendar!])
        events = eventStore.events(matching: eventPredicate).sorted(){
            (e1: EKEvent, e2: EKEvent) -> Bool in
            return e1.startDate.compare(e2.startDate) == ComparisonResult.orderedAscending
        }
    }
    
    func getDateFormatter() -> DateFormatter {

extension ViewController: EKEventEditViewDelegate {
    
    func eventEditViewController(_ controller: EKEventEditViewController, didCompleteWith action: EKEventEditViewAction) {
        loadEvents()
        self.dismiss(animated: true, completion: nil)
    }
    
