Add entity filter and refactor FlexibleQueryBuilder