     })
 
   # ------------------------------------------------------------
-  # update a note
+  # Update a note
   # return: promise
   # ------------------------------------------------------------
   update_note: (note) ->
+    # register resource data into ImageManager
+    if note.resources
+      for r in note.resources
+        imageManager.add_image_data_mapping(r.uuid, r.data_url)
+        console.log("register uuid: " + r.uuid + " data len: " + r.data_url.length)
+    # update notes db
     return @db_server.notes.query('guid').only(note['guid']).modify(note).execute()
 
   # ------------------------------------------------------------
-  # clear db
+  # Clear db
   # return: promise
   # ------------------------------------------------------------
   clear_all_notes: () ->
     return @db_server.notes.clear()
 
-  # ------------------------------- remote operations -------------------------------
-
-  # ------------------------------------------------------------
-  # fetch a remote note's all info by guid
-  # return: promise containing note's info
-  # ------------------------------------------------------------
-  fetch_remote_note: (guid) ->
-    return apiClient.notes.note({id: guid}).$promise
-
   # --------------------------------- tmp operations --------------------------------
 ]
 

    # check if the note to be loaded is already current note
    if guid != vm.note.guid
      vm.open_loading_modal()
      apiClient.notes.note({id: guid})
        .$promise.then(
          (data) ->
            # TODO handle other status
            # extract markdown
            md = data.note.md
            # register resource data into ImageManager
            for r in data.note.resources
              imageManager.add_image_data_mapping(r.uuid, r.data_url)
              console.log("register uuid: " + r.uuid + " data len: " + r.data_url.length)
            vm.set_md_and_update_editor(md)
            # render html
            vm.render_html($('#md_html_div'))
            # set note info
            vm.note.guid = data.note.guid
            vm.note.title = data.note.title
            # close modal
            vm.close_loading_modal()
          (error) ->
            alert('load note failed: ' + JSON.stringify(error))
            vm.close_loading_modal()
        )

  # ------------------------------------------------------------------------------------------------------------------
  # App Status

        @_merge_remote_notes(data['notes'])
        # FIXME need to use promise
        return @get_all_notes()

  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Merge/Sync Operations >

  # ------------------------------------------------------------
  # merge remote note list into local note list db
