             callback new KodingError "Can't create new VM."
 
   checkUsage: (account, group, callback)->
-    JVM = require '../vm'
     JVM.someData
       planOwner   : "group_#{group._id}"
       expensedUser: "user_#{account._id}"

        default       : 'not allowed'

  createVM: (account, group, data, callback)->
    JRecurlyPlan         = require '../recurly'
    JRecurlySubscription = require '../recurly/subscription'
    JVM                  = require '../vm'
    async                = require 'async'

    {type, planCode} = data

    if type is 'user'

      planCode    : 1
    , {}, (err, cursor)=>
      cursor.toArray (err, arr)=>
        return callback err  if err

        stack = []
        arr.forEach (vmData)->
          stack.push (cb)->
            JRecurlyPlan.one
              code: vmData.planCode
            , (err, plan)->
              return cb err  if err
              cb null, plan.feeMonthly

        async.parallel stack, (err, result)->
          return callback err  if err
          cost = 0
          result.forEach (fee)->
            cost += fee

          callback null, cost
