public void AppendModel(ContentItem c)
        {
            var m = c.As <BlockModelPart>();

            string            statusMessage = "";
            bool              completed     = false;
            BaseImportTools   bit           = new BaseImportTools();
            string            targetFolder;
            bool              attmemptModelLoad;
            var               bmFileName   = ExtractBlockModelFromZip(m.BmFileName, out targetFolder, out attmemptModelLoad);
            IStorageFile      bmFile       = _storageProvider.GetFile(bmFileName);
            Stream            bmFileStream = bmFile.OpenRead();
            ModelImportStatus mos          = new ModelImportStatus();

            try
            {
                // Special append method for GF requirements - contains X, Y, Z, and value to append.
                // target model must have matching X, Y and Z centroids.
                // auto generate a format defintion based on Goldfields typical input column data
                var opts = new TransactionOptions();
                opts.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (new TransactionScope(TransactionScopeOption.Suppress, opts))
                {
                    mos = bit.PerformBMAppend(bmFileStream, m.BmGuid, m.Alias, m.ColumnNameToAdd, m.ColumnIndexToAdd, _users.ApplicationConnectionString, ',');
                    mos.importTextFileName = m.BmFileName;
                    mos.targetModelName    = m.Alias;
                }
                statusMessage += string.Format("Successfully appended data to block model:\n{0} - {1}\n\nFrom file:{2}\n\n", m.Alias, m.BmGuid, m.BmFileName);
                completed      = true;
            }
            catch (Exception ex)
            {
                statusMessage += string.Format("Error appending data to block model:\n{0} - {1}\n\nFrom file:{2}\n\nError:\n{3}\n\n", m.Alias, m.BmGuid, m.BmFileName, ex.ToString());
            }
            finally {
                statusMessage += mos.GenerateStringMessage();
                bmFileStream.Close();
                _storageProvider.DeleteFile(bmFileName);
                _storageProvider.DeleteFolder(targetFolder);
            }
            statusMessage += string.Format("Time Elapsed: {0}\n\n", m.Processed.HasValue ? (DateTime.UtcNow - m.Processed.Value).ToString(@"hh\h\:mm\m\:ss\s\:fff\m\s") : "Unknown");

            Logger.Information(statusMessage);

            _users.EmailUsers(m.Recipients.SplitStringArray(), completed ? "Model Append Succeeded" : "Model Append Failed", statusMessage);
        }
        public void ProcessModel(ContentItem c)
        {
            var           m       = c.As <BlockModelPart>();
            List <string> domains = null;

            string targetFolder;
            bool   attmemptModelLoad;

            var bmFileName = ExtractBlockModelFromZip(m.BmFileName, out targetFolder, out attmemptModelLoad);

            ModelImportStatus mos = DoNewModelImport(bmFileName, m.FormatFileName, m.ProjectName, m.Alias, m.UserID, ref domains, targetFolder, attmemptModelLoad, m.Notes, m.Stage, m.StageMetaID);

            mos.importTextFileName = bmFileName + " (from " + m.BmFileName + ")";
            mos.targetModelName    = m.Alias;

            string msg     = "";
            string subject = "";

            if (mos.finalErrorCode > 0)
            {
                subject = "Model Import Failed";
                msg    += string.Format("Error importing block model:\n{0}\n\n", m.Alias, m.BmFileName);
            }
            else
            {
                subject = "Model Import Succeeded";
                msg    += string.Format("Successfully imported block model:\n{0}\n\n", m.Alias, m.BmFileName);
            }
            msg += mos.GenerateStringMessage();

            msg += string.Format("Time Elapsed: {0}\n\n", m.Processed.HasValue ? (DateTime.UtcNow - m.Processed.Value).ToString(@"hh\h\:mm\m\:ss\s\:fff\m\s") : "Unknown");

            Logger.Information(msg);

            _users.EmailUsers(m.Recipients.SplitStringArray(), subject, msg);
        }