write to database on modification