Refactor out core hashtable insertion logic.