     domains
     # newsletter holds announcements config.
     newsletter
+    # is group creator already a member 
+    alreadyMember
   } = body
 
   redirect ?= '/'

    # subscribe to koding marketing mailings or not
    body.emailFrequency.marketing = newsletter is 'true' # convert string boolean to boolean

    JUser.convert client, body, (err, result) ->

      if err?


          # handle the request with an HTTP redirect:
          res.redirect 301, redirect

    if alreadyMember
    then JUser.login client.sessionToken, req.body, createGroup
    else JUser.convert client, req.body, createGroup



# convertToArray converts given comma separated string value into cleaned,
# trimmed, lowercased, unified array of string
