added model events and validation logic