public void removeSlide(Slide slide)
        {
            int slideIndex = slideshow.indexOf(slide);

            if (slideIndex != -1)
            {
                slideshow.removeAt(slideIndex);
                if (SlideRemoved != null)
                {
                    SlideRemoved.Invoke(slide);
                }

                Slide changeToSlide = null;
                if (slide == lastEditSlide)
                {
                    if (slideIndex < slideshow.Count)
                    {
                        changeToSlide = slideshow.get(slideIndex);
                    }
                    else if (slideIndex - 1 >= 0)
                    {
                        changeToSlide = slideshow.get(slideIndex - 1);
                    }
                }

                if (changeToSlide != null)
                {
                    bool wasAllowingUndo = allowUndoCreation;
                    allowUndoCreation = false;
                    if (SlideSelected != null)
                    {
                        SlideSelected.Invoke(changeToSlide, IEnumerableUtil <Slide> .EmptyIterator);
                    }
                    allowUndoCreation = wasAllowingUndo;
                }

                if (allowUndoCreation)
                {
                    if (changeToSlide == null)
                    {
                        undoBuffer.pushAndSkip(new TwoWayDelegateCommand <SlideInfo>(new SlideInfo(slide, slideIndex),
                                                                                     new TwoWayDelegateCommand <SlideInfo> .Funcs()
                        {
                            ExecuteFunc = (executeSlide) =>
                            {
                                allowUndoCreation = false;
                                removeSlide(executeSlide.Slide);
                                allowUndoCreation = true;
                            },
                            UndoFunc = (undoSlide) =>
                            {
                                allowUndoCreation = false;
                                addSlide(undoSlide.Slide, undoSlide.Index);
                                allowUndoCreation = true;
                            },
                        }
                                                                                     ));
                    }
                    else
                    {
                        undoBuffer.pushAndSkip(new TwoWayDelegateCommand <RemoveSlideInfo>(new RemoveSlideInfo(slide, slideIndex, changeToSlide),
                                                                                           new TwoWayDelegateCommand <RemoveSlideInfo> .Funcs()
                        {
                            ExecuteFunc = (executeSlide) =>
                            {
                                //Hacky, but we cannot modify the active slide without messing up the classes that triggered this.
                                ThreadManager.invoke(new Action(delegate()
                                {
                                    allowUndoCreation = false;
                                    removeSlide(executeSlide.Slide);
                                    if (SlideSelected != null)
                                    {
                                        SlideSelected.Invoke(executeSlide.ChangeToSlide, IEnumerableUtil <Slide> .EmptyIterator);
                                    }
                                    allowUndoCreation = true;
                                }));
                            },
                            UndoFunc = (undoSlide) =>
                            {
                                //Hacky, but we cannot modify the active slide without messing up the classes that triggered this.
                                ThreadManager.invoke(new Action(delegate()
                                {
                                    allowUndoCreation = false;
                                    addSlide(undoSlide.Slide, undoSlide.Index);
                                    if (SlideSelected != null)
                                    {
                                        SlideSelected.Invoke(undoSlide.Slide, IEnumerableUtil <Slide> .EmptyIterator);
                                    }
                                    allowUndoCreation = true;
                                }));
                            },
                            PoppedFrontFunc = cleanupThumbnail
                        }));
                    }
                }
            }
        }