public string SaveDadosTransacaoPagSeguro(TransacaoPagSeguro transacaoPagSeguro)
        {
            string _msg = "";

            if (transacaoPagSeguro != null)
            {
                AssinaturaAnuidadeRepository assinaturaAnuidadeRepository = new AssinaturaAnuidadeRepository();
                RecebimentoRepository        recebimentoRepository        = new RecebimentoRepository();

                var assinatura  = assinaturaAnuidadeRepository.GetAssinaturaAnuidadeByReference(transacaoPagSeguro.Reference);
                var recebimento = recebimentoRepository.GetRecebimentoByReference(transacaoPagSeguro.Reference);

                if (assinatura != null)
                {
                    if (recebimento == null)
                    {
                        //Ainda não há regitro
                        Recebimento rec = new Recebimento()
                        {
                            RecebimentoId        = 0,
                            AssinaturaAnuidadeId = assinatura.AssinaturaAnuidadeId,
                            NotificationCodePS   = transacaoPagSeguro.NotificationCode,

                            TypePS              = transacaoPagSeguro.Type,
                            StatusPS            = transacaoPagSeguro.Status,
                            TypePaymentMethodPS = transacaoPagSeguro.PaymentMethod.Type ?? 0,
                            CodePaymentMethodPS = transacaoPagSeguro.PaymentMethod.Code ?? 0,
                            NetAmountPS         = (decimal)transacaoPagSeguro.NetAmount,
                            GrossAmountPS       = (decimal)transacaoPagSeguro.GrossAmount,
                            DiscountAmountPS    = (decimal)transacaoPagSeguro.DiscountAmount,
                            FeeAmountPS         = (decimal)transacaoPagSeguro.FeeAmount,
                            ExtraAmountPS       = (decimal)transacaoPagSeguro.ExtraAmount,
                            DtVencimento        = assinatura.DtVencimentoPagamento,
                            StatusFBTC          = "1",
                            OrigemEmissaoTitulo = "1"
                        };

                        _msg = recebimentoRepository.Insert(rec, transacaoPagSeguro.Lasteventdate);
                        _msg = assinaturaAnuidadeRepository.SetInicioPagamentoPagSeguro(transacaoPagSeguro.Reference, true);
                    }
                    else
                    {
                        recebimento.StatusPS            = transacaoPagSeguro.Status;
                        recebimento.TypePaymentMethodPS = transacaoPagSeguro.PaymentMethod.Type ?? 0;
                        recebimento.CodePaymentMethodPS = transacaoPagSeguro.PaymentMethod.Code ?? 0;
                        recebimento.NetAmountPS         = (decimal)transacaoPagSeguro.NetAmount;
                        recebimento.GrossAmountPS       = (decimal)transacaoPagSeguro.GrossAmount;
                        recebimento.DiscountAmountPS    = (decimal)transacaoPagSeguro.DiscountAmount;
                        recebimento.FeeAmountPS         = (decimal)transacaoPagSeguro.FeeAmount;
                        recebimento.ExtraAmountPS       = (decimal)transacaoPagSeguro.ExtraAmount;
                        recebimento.DtVencimento        = assinatura.DtVencimentoPagamento;

                        _msg = recebimentoRepository.UpdateRecebimentoPagSeguro(recebimento.RecebimentoId, recebimento, transacaoPagSeguro.Lasteventdate);
                    }
                }
                else
                {
                    _msg = $"ATENÇÃO: Não foi encontrado registro para a referência {transacaoPagSeguro.Reference} e NotificationCode {transacaoPagSeguro.NotificationCode} informados pelo PagSeguro";
                }
            }
            else
            {
                _msg = $"ATENÇÃO: Objeto transacaoPagSeguro está nulo";
            }

            return(_msg);
        }