Fix concurrent modification when deleting resources.
Fix a problem with multiple attempts to delete the same resource.
Fix a duplicate resource creation.