 
     { account, group } = data
 
+    token    = null
     groupObj = null
 
     unless account and group

          originId : account.getId()

        token.save (err) ->
          return callback err  if err
          token.username = account.profile.nickname
          callback null, token

    ]

    daisy queue


  @create$: permit


    queue = [

      (next) ->
        # validating data params
        unless account instanceof JAccount
          return next new KodingError 'account is not an instance of Jaccount!'

        JGroup.one { slug : group }, (err, group_) ->
          return next err                                 if err
          return next new KodingError 'group not found!'  unless group_

          unless !!group_.getAt 'isApiEnabled'
            return next new KodingError 'API usage is not enabled for this group.'

          groupObj = group_
          next()

      (next) ->
        limitError = "You can't have more than #{JGroup.API_TOKEN_LIMIT} api tokens"
        JApiToken.count { group : groupObj.slug }, (err, count) ->
          return next err                         if err
          return next new KodingError limitError  if count >= JGroup.API_TOKEN_LIMIT
          next()

      (next) ->
        # creating token
        token = new JApiToken
          code     : hat()
