   { credentials }    = stackTemplate
   credentials.custom = [credential.identifier]
 
-  # After adding custom variable, we are sharing it with the current
-  # group, so anyone in this group can reach these custom variables ~ GG
-  { slug } = kd.singletons.groupsController.getCurrentGroup()
-
-  credential.shareWith { target: slug }, (err) ->
-    console.warn 'Failed to share credential:', err  if err
-
+  shareWithGroup credential, ->
     stackTemplate.update { credentials }, (err) ->
       callback err, stackTemplate
 

kd     = require 'kd'
remote = require('app/remote').getInstance()


setStackTemplateCredential = (options, callback) ->

        createAndUpdate { provider, title, meta, stackTemplate }, callback
      else
        credential.update { meta, title }, (err) ->
          shareWithGroup credential, ->
            callback err, stackTemplate

  else
    createAndUpdate { provider, title, meta, stackTemplate }, callback
