Add abstract base class for db classes which encapsulates common
behaviour.