How would you differentiate between one input versus another?
For example, if you expect all names to be strings and all ids to be integers, you could use looks_like_number from Scalar::Util to decide if the input is a name or an id and delete from the corresponding table collection.