         if updatedNotes.count > 0 {
             updateCoreDataNotes(newNotes: updatedNotes)
         }
+        if notesToDelete.count > 0 {
+            deleteNotes(notes: notesToDelete)
+        }
+    }
+    
+    func deleteNotes(notes: [NSManagedObject]) {
+        // Get access to CoreData managedContext
+        guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
+        let managedContext = appDelegate.persistentContainer.viewContext
+        // Delete notes from context
+        for oldNote in notes {
+            print("delete note")
+            managedContext.delete(oldNote)
+        }
+        // Try save to CoreData
+        do {
+            try managedContext.save()
+        } catch let error as NSError {
+            print("Error While Deleting Note: \(error.userInfo)")
+        }
     }
     
     func updateCoreDataNotes(newNotes: [AnyObject]) {
+        print("Update notes")
         var localNotes = [NSManagedObject]()
         // Get access to CoreData managedContext
         guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }

        var dictionary = [Int:NSManagedObject]()
        for note in notes {
            dictionary[(note.value(forKeyPath: "id") as? Int)!] = note
        }
        return dictionary
    }

    func syncRemoteNotesToLocal(remoteNotes: [AnyObject]) {
        var newNotes = [AnyObject]()
        var updatedNotes = [AnyObject]()
        var notesToDelete = [NSManagedObject]()
        let localNotesDict = convertLocalNotesToDictionaryByID(notes: getNotesFromCoreData())
        let remoteNotesDict = convertRemoteNotesToDictionaryByID(notes: remoteNotes)
        // Remove deleted notes
        for (key, value) in localNotesDict {
            if remoteNotesDict[key] == nil {
               notesToDelete.append(value)
            }
        }
        // Updated current or add new notes
        for case let remoteNote as [String:AnyObject] in remoteNotes {
            // If exist local note for remote note
            if let localNote = localNotesDict[remoteNote["id"] as! Int] {
