     @param id [String] The id value
     @param callback [Function] The callback function, called with a (possible) error object and an boolean value if the specified object existed (true) or not (false)
   ###
-  exists: (model, id, callback) =>
-    debug 'create', model, data if @debug
+  exists: (model, id, callback) ->
+    debug "exists for #{model} with id: #{id}" if @debug
 
     @find model, id, (err, result) ->
-      callback err if err
-      callback null, (result.length > 0)
+      return callback err if err
+      callback null, result._result.length > 0
 
   ###
     Find a model instance by id

    @param data [Object] The data to create
    @param callback [Function] The callback function, called with a (possible) error object and the created object's id
  ###
  create: (model, data, callback) =>
    debug 'create', model, data if @debug

    aql = qb.insert('@data').in('@@collection').returnNew('inserted')
    bindVars = {
      data: data,
      '@collection': @getCollectionName(model)
    }

    @query aql, bindVars, (err, result) ->
      callback err if err
      callback null, result._result[0]._key

  ###
    Save the model instance for the given data

    @param [Function] callback Callback with (possible) error object or the number of affected objects
    @param [Object] where The filter for where
  ###
  count: (model, where, options, callback) ->
    debug "count for #{model} with where #{JSON.stringify where}" if @debug

    collection = @getCollectionName model

    bindVars =
      '@collection': collection


    aql = qb.for(returnVariable).in('@@collection')

    if !_.isEmpty(where)
      where = @_buildWhere model, where
      for w in where.aqlArray
        aql = aql.filter(w)
      merge true, bindVars, where.bindVars

    aql = aql.return(qb.fn('UNSET') returnVariable, ['"_id"','"_rev"'])

    @execute aql, bindVars, (err, result) ->
      return callback err if err
      callback null, result._result.length


  ###
