refactored creating model query builder