public static FileInfo formVisibilityTree(FileInfo contents, FileInfo visible) {
		if (contents == null || visible == null) {
			return contents;
		}
		List<FileInfo> remove = new ArrayList<>();
		for (FileInfo file: contents.getContent()) {
			boolean found = false;
			for (FileInfo v: visible.getContent()) {
				if (file.getId().equals(v.getId())) {
					found = true;
					break;
				}
			}
			if (!found) {
				remove.add(file);
			}
		}
		/* manual removal due to overloaded equals method of FileInfo */
		for (FileInfo r: remove) {
			for (int i = 0; i < contents.getContent().size(); i++) {
				FileInfo file = contents.getContent().get(i);
				if (file.getId().equals(r.getId())) {
					contents.getContent().remove(i);
					break;
				}
			}
		}
		return contents;
	}