public void CheckTable(TableMetadata iTableDef, bool iCreateIfNecessary)
        {
            try
            {
                LogMessage(TraceLevel.Verbose, "Checking Table " + iTableDef.Name + "...", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, System.Threading.Thread.CurrentThread.ManagedThreadId);

                // 1st, get the info for the table.
                if (!TableExists(iTableDef.Name))
                {
                    if (iCreateIfNecessary)
                    {
                        CreateTable(iTableDef);
                    }
                    else
                    {
                        LogMessage(TraceLevel.Verbose, "  Table '" + iTableDef.Name + "' doesn't exist", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, System.Threading.Thread.CurrentThread.ManagedThreadId);
                    }
                    return;
                }

                // table exists, now get all of the existing columns from DB schema
                DataTable loSchemaColumnsForTable = GetTableColumn(iTableDef.Name, null);
                bool      loColumnAlreadyExists   = false;
                foreach (ColumnMetadata loColumnDef in iTableDef.Fields)
                {
                    // See if the column already exists in the schema
                    loColumnAlreadyExists = false;
                    foreach (DataRow nextRow in loSchemaColumnsForTable.Rows)
                    {
                        if (string.Compare(nextRow["COLUMN_NAME"].ToString(), loColumnDef.Name, true) == 0)
                        {
                            loColumnAlreadyExists = true;
                            break;
                        }
                    }

                    if (loColumnAlreadyExists == false)
                    {
                        if (iCreateIfNecessary)
                        {
                            AddTableColumn(loColumnDef, iTableDef, iTableDef.Name);
                        }
                        else
                        {
                            LogMessage(TraceLevel.Verbose, "  Column '" + loColumnDef.Name + "' doesn't exist", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, System.Threading.Thread.CurrentThread.ManagedThreadId);
                        }
                        continue;
                    }

                    StringBuilder sbColumnDefn = new StringBuilder();
                    AddTableColStatement(loColumnDef, iTableDef, ref sbColumnDefn, true);
                    // delete the last comma
                    sbColumnDefn.Remove(sbColumnDefn.Length - 1, 1);

                    LogMessage(TraceLevel.Verbose, "  Verified column Metadata: " + sbColumnDefn.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, System.Threading.Thread.CurrentThread.ManagedThreadId);
                }

                // check this table's indexes
                CheckTableIndexes(iTableDef, iCreateIfNecessary);
            }
            catch (Exception ex)
            {
                LogMessage(TraceLevel.Error, "  Checking table Metadata failed: " + ex.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, System.Threading.Thread.CurrentThread.ManagedThreadId);
            }
        }