/// <summary> /// Remove shape. /// </summary> /// <param name="project">The project instance.</param> /// <param name="shape">The shape instance.</param> /// <returns>The owner layer.</returns> public static LayerContainer RemoveShape(this ProjectContainer project, BaseShape shape) { if (project?.Documents != null && shape != null) { var layer = project.Documents.SelectMany(d => d.Pages).SelectMany(p => p.Layers).FirstOrDefault(l => l.Shapes.Contains(shape)); if (layer != null) { project.RemoveShape(layer, shape); } return(layer); } return(null); }