private void CheckForDefaultGalleryObjectMediaObjectConflict(IGalleryControlSettings gcs)
        {
            if (!gcs.MediaObjectId.HasValue)
            {
                return;                 // No default media object is specified, so there is nothing to test.
            }

            // If a media object is specified as the default gallery object, is it contained within the hierarchy of
            // the album we are deleting?
            IGalleryObject defaultGalleryMediaObject = GetDefaultGalleryMediaObject(gcs);

            if (defaultGalleryMediaObject != null)
            {
                IGalleryObject albumParent = defaultGalleryMediaObject.Parent;
                while (!(albumParent is NullGalleryObject))
                {
                    if (albumParent.Id == _albumToDelete.Id)
                    {
                        _validationFailure       = true;
                        _validationFailureReason = GalleryObjectDeleteValidationFailureReason.AlbumContainsDefaultGalleryObjectMediaObject;
                        return;
                    }
                    albumParent = albumParent.Parent;
                }
            }
        }
        /// <summary>
        /// Checks the album to be deleted to see if it is specified as the user album container or if one of its children is the user
        /// album container. If user albums are disabled, no action is taken. If a problem is found, the member variables are updated
        /// with details.
        /// </summary>
        private void CheckForUserAlbumConflict()
        {
            IGallerySettings gallerySetting = Factory.LoadGallerySetting(_albumToDelete.GalleryId);

            if (!gallerySetting.EnableUserAlbum)
            {
                return;
            }

            IGalleryObject userAlbumParent;

            try
            {
                userAlbumParent = Factory.LoadAlbumInstance(gallerySetting.UserAlbumParentAlbumId);
            }
            catch (InvalidAlbumException ex)
            {
                // User album doesn't exist. Record the error and then return because there is no problem with deleting the current album.
                string galleryDescription = Factory.LoadGallery(gallerySetting.GalleryId).Description;
                string msg = $"User Album Parent Invalid: The gallery '{galleryDescription}' has an album ID specified ({_albumToDelete.Id}) as the user album container and it does not match an existing album. Review this setting in the administration area.";
                EventController.RecordError(new WebException(msg, ex), AppSetting.Instance, _albumToDelete.GalleryId, Factory.LoadGallerySettings());
                return;
            }

            // Test #1: Are we trying to delete the album that is specified as the user album parent album?
            if (userAlbumParent.Id == _albumToDelete.Id)
            {
                _validationFailure       = true;
                _validationFailureReason = GalleryObjectDeleteValidationFailureReason.AlbumSpecifiedAsUserAlbumContainer;
                return;
            }

            // Test #2: Does the user album parent album exist somewhere below the album we want to delete?
            IGalleryObject albumParent = userAlbumParent.Parent;

            while (!(albumParent is NullGalleryObject))
            {
                if (albumParent.Id == _albumToDelete.Id)
                {
                    _validationFailure       = true;
                    _validationFailureReason = GalleryObjectDeleteValidationFailureReason.AlbumContainsUserAlbumContainer;
                    return;
                }
                albumParent = albumParent.Parent;
            }
        }
        /// <summary>
        /// Checks the album to be deleted to see if it is specified as the user album container or if one of its children is the user
        /// album container. If user albums are disabled, no action is taken. If a problem is found, the member variables are updated
        /// with details.
        /// </summary>
        private void CheckForUserAlbumConflict()
        {
            IGallerySettings gallerySetting = Factory.LoadGallerySetting(_albumToDelete.GalleryId);

            if (!gallerySetting.EnableUserAlbum)
            {
                return;
            }

            IGalleryObject userAlbumParent;

            try
            {
                userAlbumParent = Factory.LoadAlbumInstance(gallerySetting.UserAlbumParentAlbumId);
            }
            catch (InvalidAlbumException ex)
            {
                // User album doesn't exist. Record the error and then return because there is no problem with deleting the current album.
                string galleryDescription = Factory.LoadGallery(gallerySetting.GalleryId).Description;
                string msg = String.Format(CultureInfo.CurrentCulture, Resources.Error_User_Album_Parent_Invalid_Ex_Msg, galleryDescription, _albumToDelete.Id);
                EventController.RecordError(new WebException(msg, ex), AppSetting.Instance, _albumToDelete.GalleryId, Factory.LoadGallerySettings());
                return;
            }

            // Test #1: Are we trying to delete the album that is specified as the user album parent album?
            if (userAlbumParent.Id == _albumToDelete.Id)
            {
                _validationFailure       = true;
                _validationFailureReason = GalleryObjectDeleteValidationFailureReason.AlbumSpecifiedAsUserAlbumContainer;
                return;
            }

            // Test #2: Does the user album parent album exist somewhere below the album we want to delete?
            IGalleryObject albumParent = userAlbumParent.Parent;

            while (!(albumParent is NullGalleryObject))
            {
                if (albumParent.Id == _albumToDelete.Id)
                {
                    _validationFailure       = true;
                    _validationFailureReason = GalleryObjectDeleteValidationFailureReason.AlbumContainsUserAlbumContainer;
                    return;
                }
                albumParent = albumParent.Parent;
            }
        }
        private void CheckForDefaultGalleryObjectAlbumConflict(IGalleryControlSettings gcs)
        {
            if (!gcs.AlbumId.HasValue)
            {
                return; // No default album is specified, so there is nothing to test.
            }

            // Test #1: If an album is specified as the default gallery object, is it the album we are deleting?
            if (gcs.AlbumId.Value == _albumToDelete.Id)
            {
                _validationFailure = true;
                _validationFailureReason = GalleryObjectDeleteValidationFailureReason.AlbumSpecifiedAsDefaultGalleryObject;
                return;
            }

            // Test #2: If an album is specified as the default gallery object, is it contained within the hierarchy of
            // the album we are deleting?
            IGalleryObject defaultGalleryAlbum = GetDefaultGalleryAlbum(gcs);

            if (defaultGalleryAlbum != null)
            {
                IGalleryObject albumParent = defaultGalleryAlbum.Parent;
                while (!(albumParent is NullGalleryObject))
                {
                    if (albumParent.Id == _albumToDelete.Id)
                    {
                        _validationFailure = true;
                        _validationFailureReason = GalleryObjectDeleteValidationFailureReason.AlbumContainsDefaultGalleryObjectAlbum;
                        return;
                    }
                    albumParent = albumParent.Parent;
                }
            }
        }
        /// <summary>
        /// Checks the album to be deleted to see if it is specified as the user album container or if one of its children is the user
        /// album container. If user albums are disabled, no action is taken. If a problem is found, the member variables are updated
        /// with details.
        /// </summary>
        private void CheckForUserAlbumConflict()
        {
            IGallerySettings gallerySetting = Factory.LoadGallerySetting(_albumToDelete.GalleryId);

            if (!gallerySetting.EnableUserAlbum)
                return;

            IGalleryObject userAlbumParent;
            try
            {
                userAlbumParent = Factory.LoadAlbumInstance(gallerySetting.UserAlbumParentAlbumId, false);
            }
            catch (InvalidAlbumException ex)
            {
                // User album doesn't exist. Record the error and then return because there is no problem with deleting the current album.
                string galleryDescription = Factory.LoadGallery(gallerySetting.GalleryId).Description;
                string msg = String.Format(CultureInfo.CurrentCulture, Resources.Error_User_Album_Parent_Invalid_Ex_Msg, galleryDescription, _albumToDelete.Id);
                ErrorHandler.Error.Record(new WebException(msg, ex), _albumToDelete.GalleryId, Factory.LoadGallerySettings(), AppSetting.Instance);
                return;
            }

            // Test #1: Are we trying to delete the album that is specified as the user album parent album?
            if (userAlbumParent.Id == _albumToDelete.Id)
            {
                _validationFailure = true;
                _validationFailureReason = GalleryObjectDeleteValidationFailureReason.AlbumSpecifiedAsUserAlbumContainer;
                return;
            }

            // Test #2: Does the user album parent album exist somewhere below the album we want to delete?
            IGalleryObject albumParent = userAlbumParent.Parent;
            while (!(albumParent is NullGalleryObject))
            {
                if (albumParent.Id == _albumToDelete.Id)
                {
                    _validationFailure = true;
                    _validationFailureReason = GalleryObjectDeleteValidationFailureReason.AlbumContainsUserAlbumContainer;
                    return;
                }
                albumParent = albumParent.Parent;
            }
        }