refactoring query builder by separating insert and create functionality