Group objects by their properties.