     func userContentController(userContentController: WKUserContentController, didReceiveScriptMessage message: WKScriptMessage) {
         //print("😎 \(message.name) \(message.body)")
         
-        let data = JSON(string: message.body as? String ?? "")
-        guard let messageName = data["message"].asString  else {
+        let syncResponse = SyncResponse(object: message.body)
+        guard let messageName = syncResponse.message else {
             assert(false)
             return
         }
+        
+        let data = JSON(string: message.body as? String ?? "")
+
 
         switch messageName {
         case "get-init-data":

// MARK: Server To Native Message category
extension Sync {

    func getExistingObjects(data: JSON) {
        //  as? [[String: AnyObject]]
        guard
            let objects = data["arg2"].asArray,
            let syncRecords = SyncRoot.syncObject(objects)
            else { return }
        
        /* Top level keys: "bookmark", "action","objectId", "objectData:bookmark","deviceId" */
        

        case "got-init-data":
            gotInitData()
        case "save-init-data" :
            // A bit hacky, but this method's data is not very uniform
            // (e.g. arg2 is [Int])
            let data = JSON(string: message.body as? String ?? "")
            saveInitData(data)
        case "get-existing-objects":
            // TODO: Should just return records, and immediately call resolve-sync-records
            getExistingObjects(syncResponse.rootElements)
        case "resolved-sync-records":
            resolvedSyncRecords(syncResponse.rootElements)
        case "sync-debug":
            print("---- Sync Debug: \(data)")
        case "sync-ready":
