}
for ( Map.Entry<String, List<MetadataFacetModel>> entry : metadataFacetValuesPerFacetId.entrySet() )
{
MetadataFacetFactory metadataFacetFactory = metadataFacetFactories.get( entry.getKey() );
if ( metadataFacetFactory != null )
{
List<MetadataFacetModel> facetModels = entry.getValue();
if ( !facetModels.isEmpty() )
{
MetadataFacet metadataFacet =
metadataFacetFactory.createMetadataFacet( repoId, facetModels.get( 0 ).getName() );
Map<String, String> props = new HashMap<String, String>( facetModels.size() );
for ( MetadataFacetModel metadataFacetModel : facetModels )
{
props.put( metadataFacetModel.getKey(), metadataFacetModel.getValue() );
}