protected virtual string DeleteBeforeInsert(T dataToInsert)
        {
            string tableName      = _objectsToDatabase.GetTableNameForType(dataToInsert.GetType());
            int    numRowsDeleted = _baseDao.AdoTemplate.ExecuteNonQuery(CommandType.Text, "DELETE FROM " + tableName);

            if (numRowsDeleted > 0)
            {
                return(string.Format("Deleted {0} row(s) of existing RCRA data from table {1}",
                                     numRowsDeleted.ToString(), tableName));
            }
            else
            {
                return("Did not find any existing RCRA data to delete from the data store");
            }
        }
        protected void ProcessSubmitDocument(string transactionId, string docId)
        {
            try
            {
                // Load the submission data from the xml file
                StateAssessmentDetailsDataType data = GetSubmitDocumentData(transactionId, docId);

                int numRowsDeleted = 0;
                Dictionary <string, int> tableRowCounts = null;

                _baseDao.TransactionTemplate.Execute(delegate
                {
                    if (_deleteBeforeInsert)
                    {
                        // Delete existing data from the database
                        string parentTableName = _objectsToDatabase.GetTableNameForType(data.GetType());
                        numRowsDeleted         = _baseDao.DoSimpleDelete(parentTableName, null, null);
                    }

                    // Insert data into the database
                    tableRowCounts = _objectsToDatabase.SaveToDatabase(data, _baseDao);

                    return(null);
                });

                if (numRowsDeleted > 0)
                {
                    AppendAuditLogEvent("Deleted {0} existing OWIR-ATT elements from the data store",
                                        numRowsDeleted.ToString());
                }
                else
                {
                    AppendAuditLogEvent("Did not delete any existing OWIR-ATT data from the data store");
                }
                AppendAuditLogEvent("Stored OWIR-ATT data content with primary key \"{0}\" into data store with the following table row counts: {1}",
                                    data._PK, CreateTableRowCountsString(tableRowCounts));
            }
            catch (Exception e)
            {
                AppendAuditLogEvent("Failed to process document with id \"{0}.\"  EXCEPTION: {1}",
                                    docId.ToString(), ExceptionUtils.ToShortString(e));
                throw;
            }
        }