/// <summary>
        /// Modifies a new or existing content part by name.
        /// </summary>
        /// <typeparam name="name">The name of the content part to update.</typeparam>
        /// <typeparam name="action">An action to apply on the content part.</typeparam>
        /// <returns>The current <see cref="ContentPart"/> instance.</returns>
        public static ContentItem Alter <TPart>(this ContentItem contentItem, Action <TPart> action) where TPart : ContentPart, new()
        {
            var part = contentItem.GetOrCreate <TPart>();

            action(part);
            contentItem.Apply(part);

            return(contentItem);
        }
        /// <summary>
        /// Modifies a new or existing content part by name.
        /// </summary>
        /// <typeparam name="name">The name of the content part to update.</typeparam>
        /// <typeparam name="action">An action to apply on the content part.</typeparam>
        /// <returns>The current <see cref="ContentPart"/> instance.</returns>
        public static async Task <ContentItem> AlterAsync <TPart>(this ContentItem contentItem, Func <TPart, Task> action) where TPart : ContentPart, new()
        {
            var part = contentItem.GetOrCreate <TPart>();

            await action(part);

            contentItem.Apply(part);

            return(contentItem);
        }
 /// <summary>
 /// Gets a content part by its type or create a new one.
 /// </summary>
 /// <typeparam name="TPart">The type of the content part.</typeparam>
 /// <returns>The content part instance or a new one if it doesn't exist.</returns>
 public static TPart GetOrCreate <TPart>(this ContentItem contentItem) where TPart : ContentPart, new()
 {
     return(contentItem.GetOrCreate <TPart>(typeof(TPart).Name));
 }