 remote = require('app/remote').getInstance()
+EnvironmentFlux = require 'app/flux/environment'
 
 
 module.exports = updateStackTemplate = (data, callback) ->

      templateDetails, config, description
    }

    stackTemplate.update dataToUpdate, (err, _stackTemplate) ->

      if _stackTemplate
        _stackTemplate._updated = updated
        _stackTemplate.inuse    = inuse

      callback err, _stackTemplate

  else

    remote.api.JStackTemplate.create {
      title, template, credentials, rawContent
      templateDetails, config, description
    }, callback


  if stackTemplate?.update

    dataToUpdate = if machines \
    then { machines, config }
    else {
