Dedupped one of the functions that updates secondary indexes. Fixed the unit test.