modified method to delete providerIds also when deleting a provider