               defaultPermissions  : defaultPermissionSet.permissions
             }
         ]
-        daisy queue
 
   fetchMyRoles: secure (client, callback)->
     {delegate} = client.connection

        {delegate}            = client.connection
        permissionSet         = null
        defaultPermissionSet  = null
        queue = [
          => @fetchPermissionSet (err, model)->
              if err then callback err
              else

            @one {_id: targetId}, callback

  @create = do->

    save_ =(label, model, queue, callback)->
      model.save (err)->
        if err then callback err
        else
          console.log "#{label} is saved"
          queue.next()
    
    create = secure (client, formData, callback)->
      JPermissionSet = require './permissionset'
      JMembershipPolicy = require './membershippolicy'
      JName = require '../name'
      {delegate} = client.connection
      group                 = new this formData
      permissionSet         = new JPermissionSet
      defaultPermissionSet  = new JPermissionSet
      queue = [
        # -> group.createSlug (err, slug)->
        #   if err then callback err
        #   else unless slug?
        #     callback new KodingError "Couldn't claim the slug!"
        #   else
        #     console.log "created a slug #{slug}"
        #     group.slug  = slug.slug
        #     group.slug_ = slug.slug
        #     queue.next()
        # -> save_ 'group', group, queue, callback
        # -> group.addMember delegate, (err)->
        #     if err then callback err
        #     else
        #       console.log 'member is added'
        #       queue.next()
        # -> group.addAdmin delegate, (err)->
        #     if err then callback err
        #     else
        #       console.log 'admin is added'
        #       queue.next()
        # -> save_ 'permission set', permissionSet, queue, callback
        # -> save_ 'default permission set', defaultPermissionSet, queue,
        #           callback
        # -> group.addPermissionSet permissionSet, (err)->
        #     if err then callback err
        #     else
        #       console.log 'permissionSet is added'
        #       queue.next()
        # -> group.addDefaultPermissionSet defaultPermissionSet, (err)->
        #     if err then callback err
        #     else
        #       console.log 'permissionSet is added'
        #       queue.next()
        # -> group.addDefaultRoles (err)->
        #     if err then callback err
        #     else
        #       console.log 'roles are added'
        #       queue.next()
      ]
      if 'private' is group.privacy
        queue.push -> group.createMembershipPolicy -> queue.next()
      queue.push -> callback null, group

      daisy queue

  @findSuggestions = (client, seed, options, callback)->
    {limit, blacklist, skip}  = options
