 , ['$resource', '$q', 'giSocket'
 , ($resource, $q, Socket) ->
 
-  factory = (resourceName, usePromises, prefix, idField) ->
+  factory = (resourceName, prefix, idField) ->
 
     if not prefix?
       prefix = '/api'

              removed = true
              items.splice index, 1

        callback() if callback

    destroyPromise = (id) ->
      deferred = $q.defer()
      destroy id, () ->
        deferred.resolve()
      deferred.promise

    count = () ->

      itemsById[newItem[idField]] = newItem
      return

    all = (params) ->
      deferred = $q.defer()
      options = {}
      cacheable = true
      r = resource

      if not params? and items.length > 0
        deferred.resolve items
      else
        if params?
          cacheable = false

        options = params

        if params?.query?
          r = queryResource

        r.query options, (results) ->
          if cacheable
            items = results
            angular.forEach results, (item, index) ->
              itemsById[item[idField]] = item

          deferred.resolve results

      deferred.promise

    save = (item) ->
      deferred = $q.defer()

      if item[idField]
        #we are updating
        resource.save {id: item[idField]}, item, (result) ->
          updateMasterList result
          deferred.resolve result
        , (failure) ->
          deferred.reject failure
      else
        #we are createing a new object on the server
        resource.create {}, item, (result) ->
          updateMasterList result
          deferred.resolve result
        , (failure) ->
          deferred.reject failure

      deferred.promise


    getCached = (id) ->
      return itemsById[id]
