     // MARK: - Properties
     
     var realm = try! Realm()
+    var notificationToken: NotificationToken?
     
     @IBOutlet var progressRing: UICircularProgressRingView!
     

        // Configure the view for load
        configureView()
        
        // Set the progressRing ass the tableHeaderView
        let encapsulationView = UIView() // encapsulates the view to stop clipping
        encapsulationView.addSubview(progressRing)
        self.tableView.tableHeaderView = encapsulationView
    }

    override func viewWillAppear(_ animated: Bool) {

        
        calculateProgress()
    }
    
    private func checkForEmptyView() {
        guard let count = detailItem?.assignments.count, count == 0 else {
            self.tableView.backgroundView = nil
            self.tableView.tableHeaderView?.isHidden = false
            return
        }
        
        let emptyView = UILabel(frame: CGRect(x: self.tableView.frame.midX, y: self.tableView.frame.midY, width: self.tableView.frame.width, height: 200))
        emptyView.text = "Add an assignment"
        emptyView.textAlignment = .center
        emptyView.textColor = UIColor.white
        self.tableView.backgroundView = emptyView
        self.tableView.tableHeaderView?.isHidden = true
    }
    
    deinit {
        self.notificationToken?.stop()
    }
}

