Improving model filter to work with polymorphic types.