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

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

  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...

