This exact chunk of code is in two models. Is it possible to extract this?