class ItemUtil {

	public static List<Item> stripOrphanFromAncestors(Item itemToOrphan, List<Item> ancestors) {
		List<Item> ancestorsWithoutOrphan = ancestors.stream().map((ancestor) -> {
			List<Item> children = ancestor.getChildren();
			if (null != children) {
				children.removeAll(Arrays.asList(itemToOrphan));
				ancestor.setChildren(children);
			}
			return ancestor;
		}).collect(Collectors.toList());
		return ancestorsWithoutOrphan;
	}

}