Adding method isFilterValid() and getQueryForFilter()