add refId to userentity, save refId in session