public static CopyResult Copy(Article article, bool?boundToExternal, bool disableNotifications, Guid?guidForSubstitution) { var result = new CopyResult(); Ensure.NotNull(article, string.Format(ArticleStrings.ArticleNotFound, article.Id)); if (article.IsAggregated) { return(new CopyResult { Message = MessageResult.Error(ArticleStrings.OperationIsNotAllowedForAggregated) }); } if (!article.IsArticleChangingActionsAllowed(boundToExternal)) { return(new CopyResult { Message = MessageResult.Error(ContentStrings.ArticleChangingIsProhibited) }); } article.LoadFieldValues(); if (!article.Content.IsUpdatable || !article.IsAccessible(ActionTypeCode.Read)) { return(new CopyResult { Message = MessageResult.Error(ArticleStrings.CannotCopyBecauseOfSecurity) }); } if (!article.IsUpdatableWithWorkflow) { return(new CopyResult { Message = MessageResult.Error(ArticleStrings.CannotAddBecauseOfWorkflow) }); } if (!article.IsUpdatableWithRelationSecurity) { return(new CopyResult { Message = MessageResult.Error(ArticleStrings.CannotAddBecauseOfRelationSecurity) }); } article.UniqueId = guidForSubstitution ?? Guid.NewGuid(); result.UniqueId = article.UniqueId.Value; var previousAggregatedArticles = article.AggregatedArticles; article.ReplaceAllUrlsToPlaceHolders(); try { article = ArticleRepository.Copy(article); result.Id = article.Id; article.CopyAggregates(previousAggregatedArticles); var repo = new NotificationPushRepository(); repo.PrepareNotifications(article, new[] { NotificationCode.Create }, disableNotifications); repo.SendNotifications(); } catch (UnsupportedConstraintException) { result.Message = MessageResult.Error(ArticleStrings.UnsupportedConstraint); } return(result); }