public async Task <IdentityResult> CreateNewEntryAsync(
            User user,
            long dataModelId,
            MODIFICATION modificationType,
            MODEL_TYPE modelType,
            DATA_TYPE dataType,
            string oldValue    = "",
            string actualValue = "",
            int extensionIndex = -1)
        {
            ModificationEntry entry = new ModificationEntry()
            {
                DataModelId      = dataModelId,
                DateTime         = DateTime.Now,
                DataModelType    = modelType,
                ModificationType = modificationType,
                User             = user,
                ActualValue      = actualValue,
                DataType         = dataType,
                ExtensionIndex   = extensionIndex,
                OldValue         = oldValue
            };

            if (await CreateAsync(entry) != null)
            {
                return(IdentityResult.Success);
            }
            else
            {
                return(IdentityResult.Failed());
            }
        }
        /// <summary>
        /// create a new modification entry
        /// </summary>
        /// <param name="actualValue">the actual, new value</param>
        /// <param name="oldValue">the old value</param>
        /// <param name="idOfModel">the id of model</param>
        /// <param name="modelType">the model type</param>
        /// <param name="dataType">the data type</param>
        /// <param name="userOfModification">who made the change?</param>
        /// <param name="modification">the modification type</param>
        /// <param name="index">the id of contact possibilities entry</param>
        /// <param name="shouldBeDeleted">if true, then this object should not make visible its values</param>
        /// <returns></returns>
        private static ModificationEntry GetNewModificationEntry(string actualValue, string oldValue, long idOfModel, MODEL_TYPE modelType, DATA_TYPE dataType,
                                                                 User userOfModification, MODIFICATION modification, int index = -1, bool deleteInfo = false)
        {
            ModificationEntry entry = new ModificationEntry()
            {
                ActualValue      = actualValue,
                DataModelId      = idOfModel,
                DataModelType    = modelType,
                DataType         = dataType,
                DateTime         = DateTime.Now,
                ModificationType = modification,
                OldValue         = oldValue,
                User             = userOfModification,
                ExtensionIndex   = index
            };

            if (deleteInfo)
            {
                entry.SetToDeletionState();
            }
            return(entry);
        }
 /// <summary>
 /// compare simple fields together
 /// </summary>
 /// <param name="listEntries">the list where to add a new modification entry if necessary</param>
 /// <param name="oldValue">the old value</param>
 /// <param name="newValue">the new value</param>
 /// <param name="id">the model id</param>
 /// <param name="modelType">the modelType</param>
 /// <param name="dataType">the dataType</param>
 /// <param name="userOfModification">who made this change?</param>
 /// <param name="modification">the modification type</param>
 private static void ComparePlainFields(List <ModificationEntry> listEntries, string oldValue, string newValue, long id, MODEL_TYPE modelType, DATA_TYPE dataType, User userOfModification, MODIFICATION modification)
 {
     if (oldValue == null || !oldValue.Equals(newValue))
     {
         listEntries.Add(GetNewModificationEntry(newValue, oldValue, id, modelType, dataType, userOfModification, modification));
     }
 }