Need a check for (childProperties != undefined && childProperties != null) before calling childProperties.length