Refactor prepare single criteria condition in flexible query builder