Remove code duplication and avoid unnecessary AttributeInfo search.