I don't really like this. Why is there a loop here? In case user name creation fails, group member creation fails or in case the mailer fails?

This should be constrained more, so if the intention is to loop over name creation until a valid user name is created, then just loop over the code that is necessary to do that. If you use a UUID or something for the name then the chances of a clash are so small that there is no need for a loop at all (I doubt that there is anyway for this function).

I don't think that we should be looping over `group_member_create` or `mailer.send_invite`, if either of those fail it seems ok to just notify the user and let them manually redo the invite.