Simplify and remove duplicative code from two models