private void UpdateDb(string omId, double printJobId, string almId, string fallback, CreateOutputResultCollection createOutputResultCollection)
        {
            StartTransaction();

            try
            {
                string outputJobIdentity = string.Empty;
                string printerName       = string.Empty;
                string printerId         = string.Empty;
                bool   isError           = false;
                bool   isErrorOnDocument = false;

                if (!string.IsNullOrEmpty(almId))
                {
                    isError = true;
                }

                if (createOutputResultCollection != null)
                {
                    foreach (CreateOutputResult createOutputResult in createOutputResultCollection)
                    {
                        const string DocumentTypeIDKey    = "DOCTYPE";
                        const string SubDocumentTypeIDKey = "SUBDOCTYPE";
                        const string PrinterIDKey         = "PRINTERID";
                        const string TerminalIDKey        = "TERMINALID";
                        const string PrinterDeviceNameKey = "PRINTERNAME";
                        const string UserIDKey            = "USERID";
                        const string NumberOfCopiesKey    = "NUMCOPIES";
                        const string ReportIDKey          = "REPORTID";
                        const string BinaryResultKey      = "BINARY";

                        outputJobIdentity = createOutputResult.OutputJobIdentity;
                        int jobIndentity;
                        if (!int.TryParse(outputJobIdentity, out jobIndentity))
                        {
                            jobIndentity = 0;
                        }
                        int outputJobSequenceNumber = createOutputResult.OutputJobSequenceNumber;

                        byte[] PDF            = null;
                        string docTyp         = string.Empty;
                        string docSubTyp      = string.Empty;
                        string terId          = string.Empty;
                        string numberOfCopies = string.Empty;
                        string reportId       = string.Empty;
                        string empId          = string.Empty;
                        int    noCopies       = 0;

                        isErrorOnDocument = false;
                        string errorData = createOutputResult.ErrorDescription;

                        if (!string.IsNullOrEmpty(errorData))
                        {
                            almId             = "OMS001";
                            isError           = true;
                            isErrorOnDocument = true;
                        }

                        foreach (CreateOutputResultProperty createOutputResultProperty in createOutputResult.ResultProperties)
                        {
                            if (createOutputResultProperty.PropertyName.Equals(BinaryResultKey))
                            {
                                PDF = (byte[])createOutputResultProperty.PropertyValue;
                            }
                            if (createOutputResultProperty.PropertyName.Equals(PrinterDeviceNameKey))
                            {
                                printerName = createOutputResultProperty.PropertyValue.ToString();
                            }
                            if (createOutputResultProperty.PropertyName.Equals(PrinterIDKey))
                            {
                                printerId = createOutputResultProperty.PropertyValue.ToString();
                            }
                            if (createOutputResultProperty.PropertyName.Equals(TerminalIDKey))
                            {
                                terId = createOutputResultProperty.PropertyValue.ToString();
                            }
                            if (createOutputResultProperty.PropertyName.Equals(UserIDKey))
                            {
                                empId = createOutputResultProperty.PropertyValue.ToString();
                            }
                            if (createOutputResultProperty.PropertyName.Equals(NumberOfCopiesKey))
                            {
                                numberOfCopies = createOutputResultProperty.PropertyValue.ToString();
                                if (!int.TryParse(numberOfCopies, out noCopies))
                                {
                                    noCopies = 0;
                                }
                            }
                            if (createOutputResultProperty.PropertyName.Equals(DocumentTypeIDKey))
                            {
                                docTyp = createOutputResultProperty.PropertyValue.ToString();
                            }
                            if (createOutputResultProperty.PropertyName.Equals(SubDocumentTypeIDKey))
                            {
                                docSubTyp = createOutputResultProperty.PropertyValue.ToString();
                            }
                            if (createOutputResultProperty.PropertyName.Equals(ReportIDKey))
                            {
                                reportId = createOutputResultProperty.PropertyValue.ToString();
                            }
                        }

                        /* uppdatera PrintQueeDocument */
                        if (isErrorOnDocument)
                        {
                            _printQueue.PrintDocError(printJobId, outputJobSequenceNumber, errorData, PDF, docTyp, docSubTyp, terId, printerId, printerName, empId, noCopies, reportId);
                        }
                        else
                        {
                            _printQueue.PrintDocFinished(printJobId, outputJobSequenceNumber, PDF, docTyp, docSubTyp, terId, printerId, printerName, empId, noCopies, reportId);
                        }
                    }
                }

                if (!isError)
                {
                    _printQueue.PrintFinished(printJobId, omId, fallback);
                }
                else
                {
                    _printQueue.PrintError(printJobId, almId, fallback);
                }

                Commit();
            }
            catch (Exception ex)
            {
                Rollback();

                Tracing.TraceEvent(TraceEventType.Error, 0, String.Format("Error updating database for Job: {0}\r\n{1}", printJobId, ex.Message));
            }
        }