Save ids to memory.