     return credentials
 
 
-  handleSaveChanges: ->
+  handleSaveChanges: (credentials, callback = kd.noop) ->
 
-    credentials   = @getSelectedCredentials()
+    credentials  ?= @getSelectedCredentials()
     stackTemplate = @getData()
 
     stackTemplate.update { credentials }, (err, updatedTemplate) =>
-      return @logs.handleError err  if err
+
+      if err
+        callback err
+        @logs.handleError err
+        return
 
       @logs.add 'Stack template updated successfully!'
       @emit Events.TemplateDataChanged, updatedTemplate
+      callback null
 
 
   getCredentialAddButton: ->

      Events.CredentialChangesRevertRequested
    ], @bound 'updateCredentialSelections'

    @listController.on Events.CredentialChangesSaveRequested, \
      @bound 'handleSaveChanges'

    @list = @listController.getListView()
    @list.on Events.CredentialSelectionChanged, =>

      provider isnt 'custom'

    if credentials.length is 0
      if Object.keys(selectedCredentials = @getSelectedCredentials()).length
        @handleSaveChanges selectedCredentials, callback
      else
        @emit Events.WarnAboutMissingCredentials
        callback { error: 'Missing Credentials' }
    else
      callback null

