 
     save: (id, attributes, callback) ->
         attributes.docType = @getDocType()
-        @db.get attributes.id, (err, doc) =>
+        PouchdbBackedModel.db.get attributes.id, (err, doc) =>
             if err
                 callback err
             else if not doc?

        docType = @getDocType()

        viewName = "#{docType.toLowerCase()}/#{name}"
        @db.query viewName, params, (err, body) =>
            if err
                callback err
            else
                results = []
                callback null, body.rows

    remove: (name, callback) ->
        docType = @getDocType()
        name = '_design/' + docType.toLowerCase() + '/' + name
        @db.get name, (err, doc) ->
            if err
                callback err
            else
                @db.remove doc, callback

    requestDestroy: (name, params, callback) ->
        [params, callback] = [{}, params] if typeof(params) is "function"

                callback null, true

    find: (id, callback) ->
        PouchdbBackedModel.db.get id, (err, doc) =>
            if err
                callback err
            else if not doc?
