Converting from ID objects to numeric IDs, or to prefixed IDs, should probably have it'S own method. This is done in several places in the code. Giving it a name would improve readability. Also, when building lists of ID objects, using their (numeric or prefixed) form as the array index is usually convenient.