quick Umbraco V7 question. I'm trying to programmatically remove a load of Vorto properties from a V7 site prior to upgrading, however I keep hitting 'Collection was modified; enumeration operation may not execute.'
error when running the following code:
var contentTypes = _contentTypeService.GetAllContentTypes();
foreach (var cts in contentTypes.Where(x => x.Id != 10546))
{
var vortoPropsToDelete = cts.PropertyTypes.Where(x => x.PropertyEditorAlias == "Our.Umbraco.Vorto");
foreach (var vortoProp in vortoPropsToDelete)
{
cts.RemovePropertyType(vortoProp.Alias);
}
_contentTypeService.Save(cts);
}
I can't work out were I'm going wrong...