Remove code duplication in ProductWriter #144