       dataOp = 'onUpdate'
     else if task.method is 'GET' and task.endpoint isnt '_count'
       console.log "DataOp is GET"
-      if task.entityId?
+      if task.request?.entityId?
         console.log "GetById"
         dataOp = 'onGetById'
       else if task.query?

    return registeredCollections[collectionName]

  initCompletionHandler = (task, callback) ->
    unless task.originalRequest?
      task.originalRequest = task.request

    environmentId = task.appMetadata._id


        unless result.statusCode?
          result.statusCode = 200
        console.log "About to parse entity(s)"
        result.body = JSON.stringify entity
        #if result.statusCode < 400 and entityParser.isKinveyEntity(entity) is false

          #if entity.constructor isnt Array
          #  entity = entityParser.entity entity


        result.continue = true

