Reuse the code to delete resources