private void ValidateBoundingRectangle(Rectangle? rect, Rectangle parentRectangle, bool isDefined) { var isValid = rect != null && RectangleUtil.PositiveDimensions(rect.Value) && RectangleUtil.PositiveOrZeroCoordinates(rect.Value) && parentRectangle.Encompasses(rect.Value); if (isDefined && !isValid) { throw new ArgumentException("Request bounding rectangle is invalid."); } }