private List <PropertyChangesDataInfo> BuildPropertyChangesItems(EntityEntry <IEntity> entry, AuditEntityActionEnum action)
        {
            var result = new List <PropertyChangesDataInfo>();

            //if (_auditRecordLoggerService == null)
            //{
            //    return result;
            //}

            // No property changes for deletions
            if (action == AuditEntityActionEnum.Deleted)
            {
                return(result);
            }


            if (entry.Entity is IRequireAuditing requireAuditing)
            {
                foreach (var prop in entry.CurrentValues.Properties)
                {
                    if (requireAuditing.ShouldAuditPropertyChangeFor(prop.Name))
                    {
                        var originalValue = "";
                        if (action != AuditEntityActionEnum.Added)
                        {
                            originalValue = entry.OriginalValues[prop]?.ToString();
                        }

                        var currentValue = entry.CurrentValues[prop]?.ToString();

                        if (originalValue != currentValue) //Only create a log if the value changes
                        {
                            result.Add(new PropertyChangesDataInfo()
                            {
                                Property      = prop.Name,
                                PreviousValue = originalValue,
                                NewValue      = currentValue
                            });
                        }
                    }
                }
            }

            return(result);
        }
        private IList <AuditRecordCreationDataInfo> BuildAuditRecordCreationInfo(EntityEntry <IEntity> entry, AuditEntityActionEnum action)
        {
            var result = new List <AuditRecordCreationDataInfo>();

            //if (_auditRecordLoggerService == null)
            //{
            //    return result;
            //}

            if (entry.Entity is IRequireAuditing requireAuditing)
            {
                var tempAuditInfo = new AuditRecordCreationDataInfo
                {
                    Action          = action,
                    Entity          = requireAuditing,
                    Entry           = entry,
                    PropertyChanges = BuildPropertyChangesItems(entry, action)
                };


                result.Add(tempAuditInfo);
            }

            return(result);
        }