Moved getIndexKey() from hub project because this is very generic code.