savedWidget = getRegionWidgetById(saved, item.getId());
return savedWidget;
}
private RegionWidget addNewRegionWidget(RegionWidget item) {
Page page = getPageFromRepository(item);
Region parent = getRegionById(item.getRegion().getId(), page.getRegions());
if(parent == null) throw new IllegalStateException("Unable to find parent for page");
parent.getRegionWidgets().add(item);
Page saved = template.save(page);
return getRegionById(parent.getId(), saved.getRegions()).getRegionWidgets().get(parent.getRegionWidgets().size() -1);
}