Tracke entiy changes and record them in database