       # remove duplicate _ids
       uniq = {}
       for row in response.rows
+        classes_for_event row.doc
         uniq[row.id] ?= row.doc
       next (v for k,v of uniq)
       return

            return e._id is event._id
      else
        event.title = title
        field_save 'title', event, (ok) ->
          if ok then calendar 'updateEvent', event


  resize_event = (event, dayDelta, minuteDelta, revert) ->
    delta_save event, (ok) ->
      if not ok then revert()

  classes_for_event = (event) ->
    classes = event.title?.match /#\w+/g
    if classes?
      event.className = classes.map (t) -> t.substr 1

  calendar = -> ($ '#calendar').fullCalendar arguments...

