     queryId = _.uniqueId()
     command['queryId'] = queryId
     defer = ledger.defer()
+    l "POST ", command
     @_pendingCommands[queryId] = defer
-    @_worker.postMessage JSON.parse(JSON.stringify(command))
+    @_worker.postMessage command
     defer.promise
 
   _prepare: () ->

    @_ready = no
    @_prepare()

  declare: (collection) -> @_postCommand(command: 'declare', collection: collection)

  delete: () -> @_postCommand(command: 'delete')



ledger.database ||= {}

clone = (obj) ->
  if _.isFunction(obj)
    {}
  else if _.isArray(obj)
    (clone(item) for item in obj)
  else if _.isObject(obj)
    out = {}
    for key, value of obj
      out[key] = clone(value)
    out
  else
    obj

class ledger.database.DatabasePersistenceAdapter

