Handle form validation in the model