public static Release CreateAmendment(this Release release, DateTime createdDate, Guid createdByUserId) { var amendment = release.Clone(); // Set new values for fields that should be altered in the amended // Release rather than copied from the original Release amendment.Id = Guid.NewGuid(); amendment.Published = null; amendment.PublishScheduled = null; amendment.ApprovalStatus = ReleaseApprovalStatus.Draft; amendment.Created = createdDate; amendment.CreatedById = createdByUserId; amendment.Version = release.Version + 1; amendment.PreviousVersionId = release.Id; var context = new Release.CloneContext(amendment); amendment.Content = amendment .Content ?.Select(rcs => rcs.Clone(context)) .ToList(); amendment.ContentBlocks = amendment .ContentBlocks ?.Select(rcb => rcb.Clone(context)) .ToList(); amendment.RelatedInformation = amendment .RelatedInformation ?.Select(link => link.Clone()) .ToList(); amendment.Updates = amendment .Updates ?.Select(update => update.Clone(amendment)) .ToList(); UpdateAmendmentContent(context); return(amendment); }