add basic model validation, before_save method and a custom query method