         
     }
     
-    public override func viewDidAppear(_ animated: Bool) {
-        super.viewDidAppear(animated)
-        
-        webServiceController.performReqeust()
+    
+    // MARK: Notification
+    
+    @objc public func contextDidSave(notification: Notification) {
+        
+        guard let childContext = notification.object as? NSManagedObjectContext
+            else { return }
+        
+        guard let childStoreCoordinator = childContext.persistentStoreCoordinator
+            where childStoreCoordinator === fetchedResultsController?.managedObjectContext.persistentStoreCoordinator
+            else { return }
+        
+        DispatchQueue.main.async {
+            
+            if childContext.hasChanges {
+                
+                childContext.mergeChanges(fromContextDidSave: notification)
+                
+            }
+            else { self.tableView.reloadData() }
+            
+        }
         
     }
     

                    
                    let _ = try self.fetchedResultsController?.performFetch()
                    
                }
                catch { /* TODO: error handling */ print("Error: \(error)") }
                

        guard let sections = fetchedResultsController?.sections else { return 0 }

        return sections[section].numberOfObjects
        
    }
    
    
    public override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        
        return 44.0
        
    }
    
    public override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        
        let cell = tableView.dequeueReusableCell(withIdentifier: CHTableViewCell.identifier, for: indexPath) as! CHTableViewCell
        
        if let object = fetchedResultsController?.object(at: indexPath) {
            
            cell.textLabel?.text = object.value(forKey: "data") as? String
            
        }
        
        return cell
        
    }
    
