Move AttributesUtil to API, add generic getFirstByType