private bool CanRetry(DbUpdateException ex)
        {
            //E.g. Microsoft.Data.SqlClient.SqlException(0x80131904):
            //Cannot insert duplicate key row in object 'dbo.TekReleaseWorkflowState'
            //with unique index 'IX_TekReleaseWorkflowState_BucketId'.The duplicate key value is (blah blah).
            if (ex.InnerException is SqlException sqlEx)
            {
                var errors = new SqlError[sqlEx.Errors.Count];
                sqlEx.Errors.CopyTo(errors, 0);

                return(errors.Any(x =>
                                  x.Number == 2601 &&
                                  x.Message.Contains("TekReleaseWorkflowState") &&
                                  (x.Message.Contains(nameof(TekReleaseWorkflowStateEntity.LabConfirmationId)) ||
                                   x.Message.Contains(nameof(TekReleaseWorkflowStateEntity.ConfirmationKey)) ||
                                   x.Message.Contains(nameof(TekReleaseWorkflowStateEntity.BucketId)))
                                  ));
            }

            //e.g. SQLite Error 19: 'UNIQUE constraint failed: TekReleaseWorkflowState.LabConfirmationId'.
            return(ex.InnerException is SqliteException inner &&
                   inner.SqliteErrorCode == 19 &&
                   (
                       inner.Message.Contains($"TekReleaseWorkflowState.{nameof(TekReleaseWorkflowStateEntity.LabConfirmationId)}") ||
                       inner.Message.Contains($"TekReleaseWorkflowState.{nameof(TekReleaseWorkflowStateEntity.ConfirmationKey)}") ||
                       inner.Message.Contains($"TekReleaseWorkflowState.{nameof(TekReleaseWorkflowStateEntity.BucketId)}")
                   ));
        }
        //E.g. Microsoft.Data.SqlClient.SqlException(0x80131904):
        //Cannot insert duplicate key row in object 'dbo.TekReleaseWorkflowState'
        //with unique index 'IX_TekReleaseWorkflowState_BucketId'.The duplicate key value is (blah blah).
        private bool CanRetry(DbUpdateException ex)
        {
            if (!(ex.InnerException is SqlException sqlEx))
            {
                return(false);
            }

            var errors = new SqlError[sqlEx.Errors.Count];

            sqlEx.Errors.CopyTo(errors, 0);

            return(errors.Any(x =>
                              x.Number == 2601 &&
                              x.Message.Contains("TekReleaseWorkflowState") &&
                              x.Message.Contains(nameof(TekReleaseWorkflowStateEntity.PollToken))));
        }
        //E.g. Microsoft.Data.SqlClient.SqlException(0x80131904):
        //Cannot insert duplicate key row in object 'dbo.TekReleaseWorkflowState'
        //with unique index 'IX_TekReleaseWorkflowState_BucketId'.The duplicate key value is (blah blah).
        private bool CanRetry(DbUpdateException ex)
        {
            if (!(ex.InnerException is SqlException sqlEx))
            {
                return(false);
            }

            var errors = new SqlError[sqlEx.Errors.Count];

            sqlEx.Errors.CopyTo(errors, 0);

            return(errors.Any(x =>
                              x.Number == 2601 &&
                              x.Message.Contains("TekReleaseWorkflowState") &&
                              x.Message.Contains(nameof(TekReleaseWorkflowStateEntity.GGDKey)))); // TODO: Rewritten code after removing the update on PollToken. Error can be less relative at this moment.
        }