         guard let httpRequest = prepareHttpRequest() else { completeHandler(nil); return }
         Alamofire.request(httpRequest).validate().responseJSON { response in
             if response.result.isSuccess {
+                // If Success return JSON response from the server
                 completeHandler(response.result.value as? [AnyObject])
             } else {
                 completeHandler(nil)

        }
        let localNotesDictionary = convertLocalNotesToDictionaryByID(notes: localNotes)
        // Remove old notes from CoreData
        for case let updatedNote as [String:AnyObject] in newNotes {
            managedContext.delete(localNotesDictionary[(updatedNote["id"] as! Int)]!)
        }
        do {

            addNotesToCoreData(notesArray: newNotes)
        }
        if updatedNotes.count > 0 {
            updateCoreDataNotes(updatedNotes: updatedNotes)
        }
        if notesToDelete.count > 0 {
            deleteCoreDataNotes(notes: notesToDelete)
        }
    }
    
    func deleteCoreDataNotes(notes: [NSManagedObject]) {
        // Get access to CoreData managedContext
        guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
        let managedContext = appDelegate.persistentContainer.viewContext
