         annotation.subtitle = deal.nameCompany
         self.mapView.addAnnotation(annotation)
 
+    }
+    
+    // MARK: Notification center functions.
+    func readDatabaseAgain(notification: NSNotification) {
+        mapView.removeAnnotations(mapView.annotations)
+        readDatabase()
+    }
+    
+    func reloadAnnotations(notification: NSNotification) {
+        mapView.removeAnnotations(mapView.annotations)
+        
+        displayedDeals = notification.object as! [Deal]
+        addAllAnnotations()
     }
     
     // MARK: Location Manager.

        })
    }
    
    // MARK: Load deals data from firebase and place on map.
    private func readDatabase() {
        ref.child("deals").queryOrderedByKey().observe(.childAdded, with: { (snapshot) in
            guard let snapshotDict = snapshot.value as? [String: AnyObject] else {
                return
            }
            
            let nameDeal = snapshotDict["nameDeal"]
            let nameCompany = snapshotDict["nameCompany"]
            let category = snapshotDict["category"]

        })
    }
    
    private func addAllAnnotations() {
        for deal in displayedDeals {
            addAnnotation(deal: deal)
