refactor invitecode entity