               removed = true
               items.splice index, 1
 
-        callback() if callback
+        deferred.resolve()
 
-    destroyPromise = (id) ->
-      deferred = $q.defer()
-      destroy id, () ->
-        deferred.resolve()
       deferred.promise
 
     count = () ->

      version: version
      clearCache: clearCache

    if usePromises
      exports.all = allPromise
      exports.query = allPromise
      exports.get = getPromise
      exports.save = savePromise
      exports.destroy = destroyPromise

    exports

  #export the crud factory method

, ['$resource', '$q', 'giSocket'
, ($resource, $q, Socket) ->

  factory = (resourceName, prefix, idField) ->

    if not prefix?
      prefix = '/api'
