def clear_nil_attributes(hash)
      hash.reject! do |key, value|
        if value.nil?
          return true
        elsif value.is_a? Hash
          value.reject! { |inner_key, inner_value| inner_value.nil? }
        end

        false
      end

      hash
    end
def clear_nil_attributes(hash)
      hash.reject! do |key, value|
        if value.nil?
          return true
        elsif value.is_a? Hash
          value.reject! { |inner_key, inner_value| inner_value.nil? }
        end

        false
      end

      hash
    end
Remove any attributes with nil values in a saved query hash. The API will
 already assume missing attributes are nil