public ApplicationDatabase Close()
{
if (this.budgetAnalyserDatabase == null)
{
return null;
}
this.budgetAnalyserDatabase.LedgerReconciliationToDoCollection.Clear();
// Only clears system generated tasks, not persistent user created tasks.
foreach (var service in this.databaseDependents.OrderByDescending(d => d.LoadSequence))
{
service.Close();
}
ClearDirtyDataFlags();
this.budgetAnalyserDatabase.Close();
this.monitorableDependencies.NotifyOfDependencyChange<IApplicationDatabaseService>(this);
this.monitorableDependencies.NotifyOfDependencyChange(this.budgetAnalyserDatabase);
return this.budgetAnalyserDatabase;
}