Add entity IDs to toArray output