(refac) Moved validation into model.