private void RemoveItemFromWishlist(WishListListPart wishlist, WishListItemPart itemPart)
        {
            //process extensions
            foreach (var ext in _wishListExtensionProviders)
            {
                ext.WishListItemCleanup(wishlist, itemPart);
            }

            var elementId = itemPart.ContentItem.Id;

            _contentManager.Destroy(itemPart.ContentItem); //hard delete
        }
        private void MergeUserToClosestMergeable(IUser user)
        {
            var userPart = user.ContentItem.As <UserPart>();

            if (userPart.LastLoginUtc != null)
            {
                return;
            }
            if (userPart.EmailStatus == UserStatus.Pending || userPart.RegistrationStatus == UserStatus.Pending)
            {
                return;
            }

            var closestUser = _orchardOpenAuthWebSecurity.GetClosestMergeableKnownUser(userPart);

            if (closestUser != null && closestUser.UserName != user.UserName)
            {
                closestUser.ContentItem.As <UserPart>().Password           = userPart.Password;
                closestUser.ContentItem.As <UserPart>().PasswordFormat     = userPart.PasswordFormat;
                closestUser.ContentItem.As <UserPart>().PasswordSalt       = userPart.PasswordSalt;
                closestUser.ContentItem.As <UserPart>().UserName           = userPart.UserName;
                closestUser.ContentItem.As <UserPart>().NormalizedUserName = userPart.NormalizedUserName;
                closestUser.ContentItem.As <UserPart>().HashAlgorithm      = userPart.HashAlgorithm;
                _contentManager.Destroy(userPart.ContentItem);
                _notifier.Information(T("Your account has been merged with your previous account."));
            }
        }
        private void DeleteContentItems(IEnumerable <int> selectedContentItems)
        {
            var contentItems = _recycleBin.GetMany(selectedContentItems);

            foreach (var contentItem in contentItems)
            {
                var contentItemTitle = _contentManager.GetItemMetadata(contentItem).DisplayText;
                if (!_authorizer.Authorize(Core.Contents.Permissions.DeleteContent, contentItem))
                {
                    _notifier.Error(T("You need the DeleteContent permission to permanently delete <strong>{0}</strong>.", contentItemTitle));
                    continue;
                }

                try {
                    _contentManager.Destroy(contentItem);
                    _notifier.Information(T("&quot;{0}&quot; has been permanently deleted.", contentItemTitle));
                }
                catch (Exception ex) {
                    Logger.Error(ex, "An exception occurred while trying to permanently delete content with ID {0}.", contentItem.Id);
                    _notifier.Error(T("An exception occurred while trying to permanently delete content with ID {0}.", contentItem.Id));
                }
            }
        }