 
   @createMachine = (options, callback)->
 
-    { vendor, label, meta, group, account } = options
-
-    JGroup = require '../group'
-    JGroup.one { slug: group }, (err, groupObj)=>
-
-      return callback err  if err
-      return callback new Error "Group not found"  unless groupObj
-
-      account.fetchUser (err, user)=>
-
-        return callback err  if err
-        return callback new Error "user is not defined"  unless user
-
-        users  = [{ id: user.getId(), sudo: yes, owner: yes }]
-        groups = [{ id: groupObj.getId() }]
-
-        machine = new JMachine {
-          vendor, users, groups, meta, label
-        }
-
-        machine.save (err)=>
-
-          if err
-            callback err
-            return console.warn \
-              "Failed to create Machine for ", {users, groups}
-
-          callback null, machine
+    { vendor, label, meta, group, user } = options
+
+    users  = [{ id: user.getId(), sudo: yes, owner: yes }]
+    groups = [{ id: group.getId() }]
+
+    machine = new JMachine {
+      vendor, users, groups, meta, label
+    }
+
+    machine.save (err)=>
+
+      if err
+        callback err
+        return console.warn \
+          "Failed to create Machine for ", {users, groups}
+
+      callback null, machine

    provider.remove client, options, callback


  @fetchExisting = secure revive (client, options, callback)->

    { provider } = options

    { connection: { delegate:account }, context: { group } } = client

    JGroup = require '../group'
    JGroup.one { slug: group }, (err, groupObj)=>

      return callback err  if err
      return callback new Error "Group not found"  unless groupObj

      account.fetchUser (err, user)=>

        return callback err  if err
        return callback new Error "user is not defined"  unless user

        selector =
          vendor : provider.slug
          users  : $elemMatch: id: user.getId()
          groups : $elemMatch: id: groupObj.getId()

        fieldsToFetch = label:1, meta:1, groups:1

        JMachine.someData selector, fieldsToFetch, { }, (err, cursor)->
          return callback err  if err
          cursor.toArray (err, arr) ->
            return callback err  if err

            options.machines = arr
            provider.fetchExisting client, options, callback


  @fetchAvailable = secure revive (client, options, callback)->

  engineyard   : require './engineyard'

checkCredential = (client, pubKey, callback)->

  JCredential = require './credential'
  JCredential.fetchByPublicKey client, pubKey, (err, credential)->
