 
 
 loadPath = (sessionContext, path, depth) ->
-  return true if sessionContext.new
-  depth ?= (1 << path.length) - 1
+  depth = depth or (1 << path.length) - 1
+  return true if sessionContext.new or not depth
+
+  sessionContext.toLoad ?= new Map()
 
   # Trim trailing wildcards
   trimWildcard = path.length

  for e in rpcReq.event
    params.push([['Events', e.replace(' ', '_')], timestamp,
      {object: [timestamp, 0], writable: [timestamp, 0], value: [timestamp, [timestamp, 'xsd:dateTime']]}])

  for p in params
    loadPath(sessionContext, p[0])



loadParameters = (sessionContext, callback) ->
  if not sessionContext.toLoad?.size
    return callback()

  toLoad = Array.from(sessionContext.toLoad.entries())
  db.fetchDevice(sessionContext.deviceId, sessionContext.timestamp, toLoad, (err, parameters, loaded) ->
    return callback(err) if err

    if not parameters?
