Add _dirty flag to Database class.

Store the object in the database only when it is dirty to cut down on
unnecessary traffic.

Add touch() method to allow resetting table.updated to current.