private static async Task <DatabaseClient> InitializeDb() { var client = new DatabaseClient(Filename); if (!await client.TestConnectionAsync()) { throw new Exception("Could not connect to the database."); } foreach (var table in DbTables) { if (!await client.TableExistsAsync(table.Key)) { await client.CreateTableAsync(table.Key, table.Value); } } SessionClearer.Elapsed += async(_, _) => await ClearExpiredSessions(); SessionClearer.Start(); return(client); }