public Item Duplicate(ClientPipelineArgs args)
        {
            Item result = null;

            Assert.ArgumentNotNull(args, "args");

            var database = Factory.GetDatabase(args.Parameters["database"]);

            Assert.IsNotNull(database, args.Parameters["database"]);

            var itemId     = args.Parameters["id"];
            var sourceItem = database.Items[itemId];

            if (sourceItem == null)
            {
                SheerResponse.Alert(Translate.Text("Item not found."));
            }
            else
            {
                Item parent = sourceItem.Parent;
                if (parent == null)
                {
                    SheerResponse.Alert(Translate.Text("Cannot duplicate the root item."));
                }
                else if (parent.Access.CanCreate())
                {
                    Log.Audit(this, "Duplicate item: {0}", new string[1] {
                        AuditFormatter.FormatItem(sourceItem)
                    });
                    var bucketItemOrSiteRoot = ItemExtensions.GetParentBucketItemOrSiteRoot(sourceItem);
                    if (BucketManager.IsBucket(bucketItemOrSiteRoot) && BucketManager.IsBucketable(sourceItem))
                    {
                        if (!EventDisabler.IsActive)
                        {
                            EventResult eventResult = Event.RaiseEvent("item:bucketing:duplicating", args, this);
                            if (eventResult != null && eventResult.Cancel)
                            {
                                Log.Info(string.Format("Event {0} was cancelled", "item:bucketing:duplicating"), this);
                                args.AbortPipeline();
                                return(null);
                            }
                        }
                        result = Context.Workflow.DuplicateItem(sourceItem, args.Parameters["name"]);
                        Item destination = CreateAndReturnBucketFolderDestination(bucketItemOrSiteRoot, DateUtil.ToUniversalTime(DateTime.Now), sourceItem);
                        if (!IsBucketTemplateCheck(sourceItem))
                        {
                            destination = bucketItemOrSiteRoot;
                        }

                        ItemManager.MoveItem(result, destination);

                        if (!EventDisabler.IsActive)
                        {
                            Event.RaiseEvent("item:bucketing:duplicated", args, this);
                        }
                    }
                    else
                    {
                        result = Context.Workflow.DuplicateItem(sourceItem, args.Parameters["name"]);
                    }
                }
                else
                {
                    SheerResponse.Alert(Translate.Text("You do not have permission to duplicate \"{0}\".", sourceItem.DisplayName));
                }
            }
            args.AbortPipeline();
            return(result);
        }