Refactor Invite Users Logic