     @initial.byId = {}
     @initial.data = []
 
-  reduceSuccess: (state, action) ->
-    singleId = action.payload.config.id or (
-      action.payload.config.data and action.payload.config.data.id)
-
-    state.data = [] if action.payload.config.method == 'get' and not singleId
-    data = action.payload.response.data
+  reduceSuccess: (state, {payload}) ->
+    singleId = @getItemId(payload.config) or (
+      payload.config.data and @getItemId(payload.config.data))
+
+    state.data = [] if payload.config.method == 'get' and not singleId
+    data = payload.response.data
     data = [data] unless Array.isArray(data)
 
     for item in data
-      continue unless item and item.id
-      state.byId = { state.byId..., [item.id]: item }
-      state.data = [state.data..., item.id] unless singleId
-
-    if action.payload.config.method == 'delete' and singleId
+      continue unless item and @getItemId(item)
+      id = @getItemId(item)
+      state.byId = { state.byId..., [id]: item }
+      state.data = [state.data..., id] unless singleId
+
+    if payload.config.method == 'delete' and singleId
       delete state.byId[singleId]
       state.byId = {state.byId...}
       state.data = (id for id in state.data when id != singleId)


  transformData: (data) -> data

  update: (config={}) =>
    id = config and config.id or config.data and config.data.id
    return if id then @put(config) else @post(config)

  get: (config) => @fetch(config)

  transformConfig: (config) ->
    config = super(config)
    id = (
      @getItemId(config) or
      (config.data and @getItemId(config.data)) or
      (config.params and @getItemId(config.params))
    )
    config.url += "/#{id}" if id
    return config

