         @_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

    # 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

          @delete_note(n.guid)
          console.log('local note ' + n.guid + ' deleted.')

  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| DB Operations >

  get_all_notes: () =>
    return @db_server.notes.query().all().execute()

