     @traceAction(req, 'show', "#{@_mount_info.url_prefix}:#{@idParam} format:#{format}")
     id = req.params[@idParam]
     @findOne req, id, (err, item) =>
-      console.log("find returned err:", err, "  item:", item)
-      return res.json(500, { error: "#{err}", id: id })  if err
+      # console.log("find returned err:", err, "  item:", item)
+      return res.send(500, { error: "#{err}", id: id })  if err
+      # return res.json(500, { error: "#{err}", id: id })  if err
       if item is null
-        return res.json(404, { error: "Resource not found", id: id })
+        return res.send(404, { error: "Resource not found", id: id })
+        # return res.json(404, { error: "Resource not found", id: id })
       obj = @instance2json(item)
       res.json(obj)
 

    @traceAction(req, 'delete', "#{@_mount_info.url_prefix}:#{@idParam} format:#{format}")
    id = req.params[@idParam]
    @findOne req, id, (err, item) =>
      console.log("find returned err:", err, "  item:", item)
      return res.json(500, { error: "#{err}", id: id })  if err
      if item is null
        return res.json(404, { error: "Resource not found", id: id })
      return item.remove (err) =>
        return res.json(500, { error: "#{err}", id: id })  if err
        console.log("removed #{@name} with id:#{id}")
        return res.json(200, { message: 'Ok' })

  findOne: (req, id, cb) ->

        if (not related.idParam of item) or (not item[related.idParam])
          item[related.idParam] = related_id
    item.save (err) =>
      return res.send(500, { error: "#{err}", id: id })  if err
      #console.log("created #{@name} with id:#{item.id}")
      if (req.body._format? and req.body._format == 'html') or (format == 'html')
        return res.redirect @_mount_info.url_prefix + "/#{item.id}" + ".html"
      else
