Optimizing use of database when deleting external identifiers from UI