} throw new IllegalArgumentException("DataObject not supported.");
} else throw new IllegalArgumentException("DataObject not supported.");
    public static void linkParentToChild(IObject child, IObject parent)    {        if (parent == null) return;        if (child == null) throw new IllegalArgumentException("Child cannot" +                                "be null.");        if (parent instanceof Project) {            if (!(child instanceof Dataset))                throw new IllegalArgumentException("Child not valid.");            Project p = (Project) parent;            Dataset d = (Dataset) child;            ProjectDatasetLink link;            Iterator it = d.iterateProjectLinks();            while (it.hasNext()) {                link = (ProjectDatasetLink) it.next();                if (p.getId().equals(link.parent().getId()))                    p.addProjectDatasetLink(link, false);            }        } else if (parent instanceof CategoryGroup) {            if (!(child instanceof Category))                throw new IllegalArgumentException("Child not valid.");            CategoryGroup p = (CategoryGroup) parent;            Category d = (Category) child;            CategoryGroupCategoryLink link;            Iterator it = d.iterateCategoryGroupLinks();            while (it.hasNext()) {                link = (CategoryGroupCategoryLink) it.next();                if (p.getId().equals(link.parent().getId()))                    p.addCategoryGroupCategoryLink(link, false);            }        } else if (parent instanceof Dataset) {            if (!(child instanceof Image))                throw new IllegalArgumentException("Child not valid.");            Dataset p = (Dataset) parent;            Image d = (Image) child;            DatasetImageLink link;            Iterator it = d.iterateDatasetLinks();            while (it.hasNext()) {                link = (DatasetImageLink) it.next();                if (p.getId().equals(link.parent().getId()))                    p.addDatasetImageLink(link, false);            }        } else if (parent instanceof Category) {            if (!(child instanceof Image))                throw new IllegalArgumentException("Child not valid.");            Category p = (Category) parent;            Image d = (Image) child;            CategoryImageLink link;            Iterator it = d.iterateCategoryLinks();            while (it.hasNext()) {                link = (CategoryImageLink) it.next();                if (p.getId().equals(link.parent().getId()))                    p.addCategoryImageLink(link, false);            }        }        throw new IllegalArgumentException("DataObject not supported.");    }