Use the key as a property rather than and index

ConsolidateArrayValuesByKey() currently checks the object for a $ValueKey property then tries to access the $Key as an index on the object. This fails.

Use the $Key property of the object as an index instead.
Merge pull request #1878 from hgtonight/patch-5

Use the key as a property rather than and index