How to destory a KittyItemsMarket.Collection?

Iā€™m playing with Kitty-items demo and made some modifications.

When I try to destroy and re-create a KittyItemsMarket.Collection resource and it does not work.
Here is the problem code:

My code to destroy the collection:

if let oldToken ā† acct.load<@KittyItemsMarket.Collection>(from: KittyItemsMarket.CollectionStoragePath) {
destroy oldToken

What should I do?

The code looks good, what is the problem?

error: failed to save object: path /storage/kittyItemsMarketCollection002 in account 0x251636ac5575c613 already stores an object
ā†’ 6246af60526d4be3be82a76e5efc90279adc0235f394eaaa8c04c55fd3f21d91:88:10
88 |<-KittyItemsMarket.createEmptyCollection(), to: KittyItemsMarket.CollectionStoragePath)

I got this error. since I have destroy the old one, the new created collection should be saved, right?

I see. Are you using the emulator?

Iā€™m using Testnet.

Hi @newbdez33 , I am also facing the same issue. I once removed my contract and tried to redeploy it but it throws an error

error: failed to save object: path /storage/PinataPartyContract in account 0xXXXXXX already stores an object.

Can anyone help me on this one. Thanks in advance.