move validation to model