 
 S4 = -> (((1 + Math.random()) * 65536) | 0).toString(16).substring(1)
 
-# Convert Backone.js style options object based callbacks to Node.js style
-# single function callbacks used in ShareJS
-optionsCbToNodeCb = (options) -> (err) ->
-  if err
-    options?.error?()
-  else
-    options?.success?()
 
 
 Backbone.sync = (method, model, options) ->
-  console.log "METHOD", method
-
   # Call options.success() callback to trigger destroy event which triggers
   # synchronization to other browsers.
   if method is "delete"



  add: (models, options) ->
    if models.length is 0
      return this

    if _.isArray models
      for m in models
        @_sendModelAdd m, options
    else
      @_sendModelAdd models, options

    super


    if not model.collection
      model.collection = this

    @add model, options
    return model

  fetch: (options={}) ->
    # Fetch can be called only once
    if @fetched
      return cb()
    @fetched = true

    # Convert Backbone.js style object callback to Node.js style callback
    callbackWrapper = (err) =>
      if err
        options?.error? err
      else
        @connected = true
        @_flushAddingQueue()
        @trigger "connect", this
        options?.success?()

    if options.sharejsDoc
      @_syncDoc = options.sharejsDoc
