set beforeModel method