Modified the database model helper to allow dependency injection