public override bool CopyItem(ItemDefinition source, ItemDefinition destination, string copyName, ID copyID, CallContext context) { #if DEBUG this.Trace(true, null, source.ID, destination.ID, copyName, copyID, context); #endif // source item is in head provider if (HeadProvider.GetItemDefinition(source.ID, context) != null) { if (HeadProvider.CopyItem(source, destination, copyName, copyID, context)) { return(true); } } var database = context.DataManager.Database; var itemId = source.ID; using (new SecurityDisabler()) { var item = database.GetItem(itemId); Assert.IsNotNull(item, nameof(item)); using (var limit = new RecursionLimit($"{nameof(CopyItem)}-{item.ID}-{destination.ID}", 1)) { if (limit.Exceeded) { return(true); } var defaultOptions = ItemSerializerOptions.GetDefaultOptions(); defaultOptions.AllowDefaultValues = false; // TODO: needs checking defaultOptions.AllowStandardValues = false; defaultOptions.IncludeBlobFields = true; defaultOptions.ProcessChildren = true; // TODO: slow, needs optimization var outerXml = item.GetOuterXml(defaultOptions); var target = database.GetItem(destination.ID); Assert.IsNotNull(target, nameof(target)); target.Paste(outerXml, true, PasteMode.Overwrite); Log.Audit(this, "Default item {0} ({1}) was copied to {2} in head provider", item.Name, item.ID.ToString(), destination.ID.ToString()); return(true); } } }