Refactor build_edit and build_show