BudgetAnalyser.Engine.Services.TransactionManagerService.SaveAsync C# (CSharp) Method

SaveAsync() public method

Saves the application database asynchronously. This may be called using a background worker thread.
/// Unable to save transactions at this time, some data is invalid. + /// messages ///
public SaveAsync ( ApplicationDatabase applicationDatabase ) : System.Threading.Tasks.Task
applicationDatabase BudgetAnalyser.Engine.Persistence.ApplicationDatabase
return System.Threading.Tasks.Task
        public async Task SaveAsync(ApplicationDatabase applicationDatabase)
        {
            if (StatementModel == null)
            {
                return;
            }

            EventHandler<AdditionalInformationRequestedEventArgs> handler = Saving;
            handler?.Invoke(this, new AdditionalInformationRequestedEventArgs());

            var messages = new StringBuilder();
            if (!ValidateModel(messages))
            {
                throw new ValidationWarningException("Unable to save transactions at this time, some data is invalid. " + messages);
            }

            StatementModel.StorageKey = applicationDatabase.FullPath(applicationDatabase.StatementModelStorageKey);
            await this.statementRepository.SaveAsync(StatementModel, applicationDatabase.IsEncrypted);
            this.monitorableDependencies.NotifyOfDependencyChange(StatementModel);
            Saved?.Invoke(this, EventArgs.Empty);
        }