I've renamed the variable nextValue to nextRowValuesByColumnIndex, which is where 'next' above will eventually land.  Restating in other words what I said above, toExternalRow needs the key and value.