pulled some invite logic out of the GUI
refactored functions for creating a new user and inviting a user