/// /// <param name="resource"></param> private void fixResourceHref(Resource resource) { if (StringUtil.isNotBlank(resource.getHref()) && !resources.ContainsKey(resource.getHref())) { return; } if (StringUtil.isBlank(resource.getHref())) { if (resource.getMediaType() == null) { throw new ArgumentException("Resource must have either a MediaType or a href"); } int i = 1; String href = createHref(resource.getMediaType(), i); while (resources.ContainsKey(href)) { href = createHref(resource.getMediaType(), (++i)); } resource.setHref(href); } }