private static SlidePart CreateSlidePart(PresentationPart presentationPart)
 {
     SlidePart slidePart1 = presentationPart.AddNewPart<SlidePart>("rId2");
     slidePart1.Slide = new Slide(
             new CommonSlideData(
                 new ShapeTree(
                     new P.NonVisualGroupShapeProperties(
                         new P.NonVisualDrawingProperties() { Id = (UInt32Value)1U, Name = "" },
                         new P.NonVisualGroupShapeDrawingProperties(),
                         new ApplicationNonVisualDrawingProperties()),
                     new GroupShapeProperties(new TransformGroup()),
                     new P.Shape(
                         new P.NonVisualShapeProperties(
                             new P.NonVisualDrawingProperties() { Id = (UInt32Value)2U, Name = "Title 1" },
                             new P.NonVisualShapeDrawingProperties(new ShapeLocks() { NoGrouping = true }),
                             new ApplicationNonVisualDrawingProperties(new PlaceholderShape())),
                         new P.ShapeProperties(),
                         new P.TextBody(
                             new BodyProperties(),
                             new ListStyle(),
                             new Paragraph(new EndParagraphRunProperties() { Language = "en-US" }))))),
             new ColorMapOverride(new MasterColorMapping()));
     return slidePart1;
 }
        //http://stackoverflow.com/questions/32076114/c-sharp-openxml-sdk-2-5-insert-new-slide-from-slide-masters-with-the-layout
        public static SlidePart AppendNewSlide(PresentationPart presentationPart, SlideLayoutPart masterLayoutPart, out IEnumerable<Shape> placeholderShapes)
        {
            Slide clonedSlide = new Slide() {
                ColorMapOverride = new ColorMapOverride {
                    MasterColorMapping = new Draw.MasterColorMapping()
                }
            };

            SlidePart clonedSlidePart = presentationPart.AddNewPart<SlidePart>();
            clonedSlidePart.Slide = clonedSlide;
            clonedSlidePart.AddPart(masterLayoutPart);
            clonedSlide.Save(clonedSlidePart);

            var masterShapeTree = masterLayoutPart.SlideLayout.CommonSlideData.ShapeTree;

            placeholderShapes = (from s in masterShapeTree.ChildElements<Shape>()
                                   where s.NonVisualShapeProperties.OfType<ApplicationNonVisualDrawingProperties>().Any(anvdp=>anvdp.PlaceholderShape != null)
                                   select new Shape()
                                   {
                                       NonVisualShapeProperties = (NonVisualShapeProperties)s.NonVisualShapeProperties.CloneNode(true),
                                       TextBody = new TextBody(s.TextBody.ChildElements<Draw.Paragraph>().Select(p => p.CloneNode(true))) {
                                           BodyProperties = new Draw.BodyProperties(),
                                           ListStyle = new Draw.ListStyle()
                                       },
                                       ShapeProperties = new ShapeProperties()
                                   }).ToList();

            clonedSlide.CommonSlideData = new CommonSlideData
            {
                ShapeTree = new ShapeTree(placeholderShapes) {
                    GroupShapeProperties = (GroupShapeProperties)masterShapeTree.GroupShapeProperties.CloneNode(true),
                    NonVisualGroupShapeProperties = (NonVisualGroupShapeProperties)masterShapeTree.NonVisualGroupShapeProperties.CloneNode(true)
                }
            };

            SlideIdList slideIdList = presentationPart.Presentation.SlideIdList;

            // Find the highest slide ID in the current list.
            uint maxSlideId = slideIdList.Max(c=>(uint?)((SlideId)c).Id) ?? 256;

            // Insert the new slide into the slide list after the previous slide.
            slideIdList.Append(new SlideId() {
                Id = ++maxSlideId,
                RelationshipId = presentationPart.GetIdOfPart(clonedSlidePart)
            });
            //presentationPart.Presentation.Save();

            return clonedSlidePart;
        }