@SuppressWarnings("unchecked")
private void copyChildComponents(UIComponent component, List<UIComponent> destination) {
for (UIComponent child : (List<UIComponent>) component.getChildren()) {
List<JsfTemplate> spotTemplates = children.getSpotTemplates(child.getId());
TemplateComponent hiddenTemplateComponent = hiddenTemplateComponentById.get(child.getId());
if (spotTemplates != null) {
for (JsfTemplate template : spotTemplates) {
destination.addAll(template.process());
}
} else if (hiddenTemplateComponent != null) {
destination.addAll(hiddenTemplateComponent.makeTemplate(variables).process());
} else {
destination.add(deepCloneComponent(child));
}
}
}