}
private String getAllDepartmentsAndChildDepartmentsForUserAsString(StringBuilder stringBuilder, Set<BODepartment> departmentsOwned, int counter) {
for (Iterator departmentsOwnedIterator = departmentsOwned.iterator(); departmentsOwnedIterator.hasNext();) {
BODepartment currentDepartment = (BODepartment) departmentsOwnedIterator.next();
if (counter == 0) {
stringBuilder.append(currentDepartment.getDepartmentID());
} else {
stringBuilder.append(", " + currentDepartment.getDepartmentID());
}
counter++;
if (currentDepartment.getChildDepartments() != null) {
getAllDepartmentsAndChildDepartmentsForUserAsString(stringBuilder, currentDepartment.getChildDepartments(), counter);
}
}
return stringBuilder.toString();
}