Add a validate method for ActiveRecord to prevent persisting invalid states.