Add transaction support to Dbobject.count()