 
     models.forEach (model) ->
 
-      switch model
-        when 'StackTemplate'
-          queue.push ->
-            _createStackTemplate client, options, (data_) ->
-              data = _.extend data, data_
-              queue.next()
+      fn = switch model
+        when 'Credential'       then _createCredential
+        when 'Provisioner'      then _createProvisioner
+        when 'StackTemplate'    then _createStackTemplate
+        when 'Stack'            then _createStack
+        when 'ComputeProvider'  then _createComputeProvider
+        else                         callback 'invalid request'
 
-        when 'Stack'
-          queue.push ->
-            _createStack client, options, (data_) ->
-              data = _.extend data, data_
-              queue.next()
-
-        when 'Provisioner'
-          queue.push ->
-            createProvisioner client, options, (err, data_) ->
-              expect(err).to.not.exist
-              data = _.extend data, data_
-              queue.next()
+      queue.push ->
+        fn client, options, (data_) ->
+          data = _.extend data, data_
+          queue.next()
 
     queue.push -> callback data
 

  withConvertedUser }    = require '../../index'
{ createProvisioner }    = require './provisionerhelper'
{ createStackTemplate }  = require './stacktemplatehelper'

JGroup          = require '../../../../social/lib/social/models/group'
JProvisioner    = require '../../../../social/lib/social/models/computeproviders/provisioner'

    { client, user, account } = data
    { group : groupSlug }     = client.context

    _createCredential = (client, options, callback) ->
      createCredential client, options, (err, data_) ->
        expect(err).to.not.exist
        callback data_


    _createProvisioner = (client, options, callback) ->
      createProvisioner client, options, (err, data_) ->
        expect(err).to.not.exist
        callback data_


    _createStackTemplate = (client, options, callback) ->
      createStackTemplate client, options, (err, template) ->
        expect(err).to.not.exist
        callback { template }


    _createStack = (client, options, callback) ->
