/// <summary>
        /// Import from a class defined csv file.  Remove all existing
        /// records in the target data set, load new rows and archive
        /// the records for restore points
        /// </summary>
        /// <param name="data"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public ImportResult Load(Stream data, User user)
        {
            if (ReadOnly)
            {
                return(null);
            }

            var reader = new StreamReader(data);
            var csv    = reader.ReadToEnd();

            var engine = new FileHelperEngine <T> {
                ErrorMode = ErrorMode.SaveAndContinue
            };
            var rows    = engine.ReadString(csv);
            var results = new ImportResult {
                ImportCount = rows.Length, Errors = engine.ErrorManager
            };

            if (results.Errors.ErrorCount == 0)
            {
                var trans = new SqlTransaction((AbstractSqlConnectionDescriptor)_writeDao.ConnDesc);
                try
                {
                    // Refresh the data if successfull
                    PreProcess(trans, rows);
                    _writeDao.DeleteAll(trans);
                    _writeDao.Insert(trans, rows);
                    PostProcess(trans, rows);
                    trans.Commit();

                    PdbUploadRevision.AddUploadRevision(UploadType, csv, user);
                }
                catch (Exception)
                {
                    trans.Rollback();
                    throw;
                }
            }
            return(results);
        }