                     details: data.details
                 , (err) ->
                     event.beforeUpdate = oldValue
-                    callback err, event
+                    callback err, event, changes
             else
-                callback null, event
+                callback null, event, changes
         else
-            Event.create data, callback
+            changes.creation = true
+            Event.create data, (err, event) ->
+                callback err, event, changes
 
-Event.getInRange = (options, callback) ->
-    Event.request 'byDate', options, callback

    lastModification: type: String
    caldavuri   : type: String

require('cozy-ical').decorateEvent Event

Event.all = (params, callback) ->
    Event.request "all", params, callback

Event.byCalendar = (calendarId, callback) ->
    Event.request 'byCalendar', key: calendarId, callback

Event.createOrUpdate = (data, callback) ->
    {id} = data

americano = require 'cozydb'
ical = require 'cozy-ical'
log = require('printit')
    prefix: 'event:model'

