Refactor share_user code