class LayerBuilder {

    public List<WMSEnvoyAndLayerEnvoy> buildLayers(Collection<? extends WMSEnvoyAndState> layerStates, String stateId,
            Collection<? extends String> tags)
    {
        List<WMSEnvoyAndLayerEnvoy> builtEnvoys = New.list();

        for (WMSEnvoyAndState envoyAndState : layerStates)
        {
            WMSEnvoy envoy = envoyAndState.getEnvoy();
            WMSLayerState state = envoyAndState.getState();
            WMSDataType existingWmsType = envoyAndState.getTypeInfo();
            String layerName = envoyAndState.getLayerName();

            WMSDataType newDataType = createNewDataType(existingWmsType, state, stateId, envoy, tags, layerName);

            WMSLayer newLayer = myLayerCreator.createLayer(newDataType, state.getMinDisplaySize(), state.getMaxDisplaySize());
            WMSGetMapEnvoy newEnvoy = new WMSGetMapEnvoy(newLayer, newDataType.getToolbox(), null,
                    envoy.getServerConnectionConfig(), envoy.getWMSVersion());

            WMSEnvoyAndLayerEnvoy envoyAndLayer = new WMSEnvoyAndLayerEnvoy(envoy, newEnvoy);

            builtEnvoys.add(envoyAndLayer);
        }

        return builtEnvoys;
    }

    public  LayerBuilder(WMSLayerCreator layerCreator, WMSDataTypeFactory factory);

}