public int getIndexOfChild(Object parent, Object child) {
        if (parent instanceof Page) {
            Page p = (Page)parent;

            if (child instanceof Page) {
                return p.children.indexOf(child);
            } else {
                return p.names.indexOf(child);
            }
        }

        throw new NotImplementedException();
    }