               if err then callback err
               else
                 console.log 'admin is added'
-                permissionSet = new JPermissionSet
                 queue.next()
           -> permissionSet.save (err)->
               if err then callback err


  @create = secure (client, formData, callback)->
    JPermissionSet = require './permissionset'
    JName = require '../name'
    {delegate} = client.connection
    JName.claim formData.slug, 'JGroup', 'slug', (err)=>
      if err then callback err
      else
        group         = new @ formData
        permissionSet = null

        queue = [
          -> group.save (err)->

              else
                console.log 'group is added'
                queue.next()
          -> membershipPolicy.save (err)->
            if err then callback err
            else queue.next()
          -> group.addMembershipPolicy membershipPolicy, (err)->
            if err then callback err
            else queue.next()
          -> callback null, group
        ]

