refactor masterdetail and lookup