       @deleteItem()
 
   deleteItem:->
-    {controller} = @getDelegate()
-    controller.removeItem @
-    controller.emit "UpdatedItems"
+    @getDelegate().emit "RemoveItem", @
 
   saveItem:->
-    {controller} = @getDelegate()
     @data =
       key   : @form.keyTextarea.getValue()
       title : @form.titleInput.getValue()
       
     if @data.key and @data.title
       @info.$('span.title').text @data.title
-      @info.$('span.key').text "#{@data().key.substr(0,45)} . . . #{@data().key.substr(-25)}"
+      @info.$('span.key').text "#{@data.key.substr(0,45)} . . . #{@data.key.substr(-25)}"
       @swappable.swapViews()
-      controller.emit "UpdatedItems"
+      @getDelegate().emit "UpdatedItems"
     else
       new KDNotificationView
         title : "Key shouldn't be empty."


    @loadItems()

    @getListView().controller = @

    @on "UpdatedItems", =>
      newKeys = @getItemsOrdered().map (item)-> item.getData()
      KD.remote.api.JUser.setSSHKeys newKeys, ->
        console.log "Updated keys", arguments

  loadItems: ()->
    @removeAllItems()

      iconOnly  : yes
      iconClass : "plus"
      callback  : =>
        @addItem {key: '', title: ''}, 0
        @getListView().items.first.swapSwappable()

class AccountSshKeyList extends KDListView
  constructor:(options,data)->
