           @load( data )
 
   reset: (params) ->
+    if !App[ params.type ]
+      @log 'Collection', 'error', 'reset', 'no such collection', params
+      return
     @log 'Collection', 'debug', 'reset', params
 
     # empty in-memory

      return data

  get: (params) ->
    @log 'Collection', 'debug', 'get', params
    App[ params.type ].refresh( object, options: { clear: true } )

  all: (params) ->
    all = App[ params.type ].all()
    all_complied = []
    for item in all

    App[type].deleteAll()

  findByAttribute: ( type, key, value ) ->
    if !App[type]
      @log 'Collection', 'error', 'findByAttribute', 'no such collection', type, key, value
      return
    item = App[type].findByAttribute( key, value )
    if !item
      @log 'Collection', 'error', 'findByAttribute', 'no such item in collection', type, key, value
      return
    item

  count: ( type ) ->
    if !App[type]
      @log 'Collection', 'error', 'count', 'no such collection', type, key, value
      return
    App[type].count()

  fetch: ( type ) ->
    if !App[type]
      @log 'Collection', 'error', 'fetch', 'no such collection', type, key, value
      return
    App[type].fetch()

  _sortBy: ( collection, attribute ) ->
