/// <summary>
        ///     <para>
        ///         Gets or sets a value indicating whether or not this property can be modified after the entity is
        ///         saved to the database.
        ///     </para>
        ///     <para>
        ///         If <see cref="PropertySaveBehavior.Throw" />, then an exception
        ///         will be thrown if a new value is assigned to this property after the entity exists in the database.
        ///     </para>
        ///     <para>
        ///         If <see cref="PropertySaveBehavior.Ignore" />, then any modification to the
        ///         property value of an entity that already exists in the database will be ignored.
        ///     </para>
        /// </summary>
        /// <param name="property"> The property. </param>
        /// <param name="afterSaveBehavior">
        ///     A value indicating whether or not this property can be modified after the entity is saved to the database.
        /// </param>
        public static void SetAfterSaveBehavior([NotNull] this IMutableProperty property, PropertySaveBehavior?afterSaveBehavior)
        {
            if (afterSaveBehavior != null)
            {
                var errorMessage = property.CheckAfterSaveBehavior(afterSaveBehavior.Value);
                if (errorMessage != null)
                {
                    throw new InvalidOperationException(errorMessage);
                }
            }

            property[CoreAnnotationNames.AfterSaveBehavior] = afterSaveBehavior;
        }