generate model init with initChildren ordered by external parent count