PlatformLayerKey resolved = path.resolve(getContext());
UntypedItemXml item = (UntypedItemXml) client.getItemUntyped(resolved, Format.XML);
Links links = item.getLinks();
Link link = new Link();
link.name = name;
link.target = target.resolve(getContext());
Link existing = links.findLink(name);
List<Link> linkList = links.getLinks();
if (existing != null) {
linkList.remove(existing);
}
linkList.add(link);