public void Unshelve()
        {
            Shelveset shelveset;
            bool      result;

            if (PendingChanges.All(model => model.IncludeChange))
            {
                result = teamPilgrimServiceModelProvider.TryWorkspaceUnshelve(WorkspaceServiceModel.Workspace, out shelveset, Shelveset.Name, Shelveset.OwnerName);
            }
            else
            {
                var itemSpecs = PendingChanges
                                .Where(model => model.IncludeChange)
                                .Select(model => new ItemSpec(model.Change))
                                .ToArray();

                result = teamPilgrimServiceModelProvider.TryWorkspaceUnshelve(WorkspaceServiceModel.Workspace, out shelveset,
                                                                              Shelveset.Name, Shelveset.OwnerName, itemSpecs);
            }

            if (result)
            {
                if (RestoreWorkItemsAndCheckinNotes)
                {
                    foreach (var workItemCheckinInfo in Shelveset.WorkItemInfo)
                    {
                        WorkspaceServiceModel.SelectWorkItemById(workItemCheckinInfo.WorkItem.Id);
                    }

                    foreach (var checkinNoteFieldValue in this.Shelveset.CheckinNote.Values)
                    {
                        WorkspaceServiceModel.RestoreCheckinNoteFieldValue(checkinNoteFieldValue);
                    }
                }

                if (!PreserveShelveset)
                {
                    teamPilgrimServiceModelProvider.TryDeleteShelveset(ProjectCollectionServiceModel.TfsTeamProjectCollection, shelveset.Name, shelveset.OwnerName);
                }
            }

            OnDismiss(result, true);
        }