most of the add user to group logic