       Events.CredentialChangesRevertRequested
     ], @bound 'updateCredentialSelections'
 
-    @listController.on Events.CredentialChangesSaveRequested, \
-      @bound 'handleSaveChanges'
+    @listController.on Events.CredentialChangesSaveRequested, =>
+      @handleSaveChanges()
 
     @list = @listController.getListView()
     @list.on Events.CredentialSelectionChanged, =>

      provider isnt 'custom'

    if credentials.length is 0
      @emit Events.WarnAboutMissingCredentials
      callback { error: 'Missing Credentials' }
    else
      callback null


    return credentials


  handleSaveChanges: (credentials, callback = kd.noop) ->

    credentials  ?= @getSelectedCredentials()
    stackTemplate = @getData()

    stackTemplate.update { credentials }, (err, updatedTemplate) =>

      if err
        callback err
        @logs.handleError err
        return

      @logs.add 'Stack template updated successfully!'
      @emit Events.TemplateDataChanged, updatedTemplate
      callback null


  getCredentialAddButton: ->
