     [className, changes] = data
     return unless className in ["List", "Task"]
     id = changes.id
+
+    # Check model exists on server
+    if not @user.data(className).hasOwnProperty id
+      console.log "#{className} doesn't exist on server"
+      return
+
     # Set timestamp
     timestamps = data[2]
     if timestamps

    [className, model] = data
    return unless className in ["List", "Task"]
    # Generate new id
    id = "s-" + @user.index(className)
    @user.incrIndex className
    model.id = id
    # Add item to server
    group = @user.data(className)
    if not group
      group = @user.data(className, {})
    group[id] = model
    # Save to server
    @user.save(className)

    @emit 'destroy', [className, id]


  # --------------------
  # Offline Sync Merging
  # --------------------

  # Sync
  sync: (queue, fn) =>
    Log "Running sync"
    for event in queue
      [type, [className, model], timestamp] = event

      switch type
        when "create"
          @create [className, model, timestamp]

        when "update"
          @update [className, model, timestamp]

        when "destroy"
          if @checkTime className, id, timestamp
            @destroy [className, model, timestamp]

    fn [@getArray("Task"), @getArray("List")] if fn

module?.exports = Sync
