private void EnsureSchemaForTable(string tableName, SQLiteConnection db, IDictionary<string, Column> columns)
        {
            EnsureDatabaseThread();

            try
            {
                //check if database exists
                if (!db.DoesTableExist(tableName))
                {
                    Debug.WriteLine("Table doesn't exist: {0}", tableName);

                    db.CreateTable(tableName, columns);

                    Debug.WriteLine("Table {0} created with columns {1}.", tableName, string.Join<Column>("\n", columns.Values));
                    Debug.WriteLine("Creating index for table {0} on column 'id'", tableName);

                    db.CreateIndex(tableName, "id");
                }
                else
                {
                    Debug.WriteLine("Table exists: {0}", tableName);
                    Debug.WriteLine("Querying table structure for table: {0}", tableName);

                    IDictionary<string, Column> tableColumns = db.GetColumnsForTable(tableName);

                    Debug.WriteLine("Table {0} has columns: {1}", tableName, string.Join<Column>("\n", tableColumns.Values));

                    IDictionary<string, Column> newColumns = this.DetermineNewColumns(tableColumns, columns);
                    foreach (var col in newColumns)
                    {
                        db.AddColumnForTable(tableName, col.Value);
                    }
                }
            }
            catch (SQLiteException ex)
            {
                throw new Exception(string.Format("Error occurred during interaction with the local database: {0}", ex.Message));
            }
        }