Assign objects to categories based on an object property.