Refactor test database access into [MODEL].count