public void RemoveEmptySections() { SectionProperties sectionProperties = SectionProperties; for (int i = sectionProperties.Count; i >= 1; i--) { if (sectionProperties.SlidesCount(i) == 0) { sectionProperties.Delete(i, false); } } }