/// <summary>
        ///     Called to write save audit log entries.
        /// </summary>
        /// <param name="success">if set to <c>true</c> [success].</param>
        /// <param name="accessRuleDetails">The user account details.</param>
        protected override void OnWriteSaveAuditLogEntries(bool success, AuditLogUserAccountDetails accessRuleDetails)
        {
            if (accessRuleDetails.IsTemporaryId)
            {
                // Entity is being created
                AuditLog.OnCreateUserAccount(success, accessRuleDetails.UserName);
            }

            if (!accessRuleDetails.IsTemporaryId &&
                accessRuleDetails.OldUserName != accessRuleDetails.UserName)
            {
                // Name has changed
                AuditLog.OnRenameUserAccount(success, accessRuleDetails.OldUserName, accessRuleDetails.UserName);
            }

            if (!accessRuleDetails.IsTemporaryId &&
                accessRuleDetails.HasPasswordChanged)
            {
                // Password has changed
                AuditLog.OnChangeUserAccountPassword(success, accessRuleDetails.UserName);
            }

            if (!accessRuleDetails.IsTemporaryId &&
                accessRuleDetails.ExpirationDate != accessRuleDetails.OldExpirationDate)
            {
                // Expiration date has changed
                AuditLog.OnChangeUserAccountExpiry(success, accessRuleDetails.UserName, accessRuleDetails.OldExpirationDate, accessRuleDetails.ExpirationDate);
            }

            if (!accessRuleDetails.IsTemporaryId &&
                accessRuleDetails.Status != accessRuleDetails.OldStatus)
            {
                // Status has changed
                switch (accessRuleDetails.Status)
                {
                case UserAccountStatusEnum_Enumeration.Expired:
                    AuditLog.OnExpiredUserAccount(success, accessRuleDetails.UserName);
                    break;

                case UserAccountStatusEnum_Enumeration.Locked:
                    AuditLog.OnLockUserAccount(success, accessRuleDetails.UserName);
                    break;

                default:
                    AuditLog.OnChangeUserAccountStatus(success, accessRuleDetails.UserName, accessRuleDetails.OldStatus.ToString(), accessRuleDetails.Status.ToString());
                    break;
                }
            }

            ISet <string> currentAccount = new HashSet <string> {
                accessRuleDetails.UserName
            };

            if (accessRuleDetails.AddedUserHasRoles.Count > 0)
            {
                foreach (string addedUserHasRole in accessRuleDetails.AddedUserHasRoles)
                {
                    // Role membership has changed
                    AuditLog.OnChangeUserRoleMembers(success, addedUserHasRole, currentAccount, new SortedSet <string>());
                }
            }

            if (accessRuleDetails.RemovedUserHasRoles.Count > 0)
            {
                foreach (string removedUserHasRole in accessRuleDetails.RemovedUserHasRoles)
                {
                    // Role membership has changed
                    AuditLog.OnChangeUserRoleMembers(success, removedUserHasRole, new SortedSet <string>(), currentAccount);
                }
            }
        }