internal Shape GetShapeByPPlaceholderShape(P.PlaceholderShape inpPPlaceholderShape) { IEnumerable <Shape> placeholderShapes = CollectionItems.Where(sp => sp.Placeholder != null).OfType <Shape>(); Shape mappedShape = placeholderShapes.FirstOrDefault(IsEqual); bool IsEqual(Shape collectionShape) { Placeholder placeholder = (Placeholder)collectionShape.Placeholder; P.PlaceholderShape colPPlaceholderShape = placeholder.PPlaceholderShape; if (inpPPlaceholderShape.Index != null && colPPlaceholderShape.Index != null && inpPPlaceholderShape.Index == colPPlaceholderShape.Index) { return(true); } if (inpPPlaceholderShape.Type != null && colPPlaceholderShape.Type != null) { if (inpPPlaceholderShape.Type == P.PlaceholderValues.Body && inpPPlaceholderShape.Index != null && colPPlaceholderShape.Index != null) { return(inpPPlaceholderShape.Index == colPPlaceholderShape.Index); } return(inpPPlaceholderShape.Type.Equals(colPPlaceholderShape.Type)); } return(false); } return(mappedShape); }