public async Task <ActionResult> ExixtingUserTransactionRegistration(long userId, [FromBody] UserTransactionRegistrationDto registerationDto)
            {
                if (!_customAuth.IsUserAllowedAccess(userId, HttpContext))
                {
                    return(StatusCode(401));
                }
                var response = await _tranService.AddTransactionForExistingUser(userId, registerationDto);

                return(StatusCode(response.Status, response));
            }
        public async Task <ApiResponseDto <bool> > AddTransactionForExistingUser(long userId, UserTransactionRegistrationDto userTransactionDto)
        {
            var user = await _userRepo.GetUser(userId);

            await _authServices.Register(userTransactionDto.SecondParty);

            var secondParty = await _userRepo.FindUserByEmail(userTransactionDto.SecondParty.Email);

            if (user == null || secondParty == null)
            {
                return(new ApiResponseDto <bool>(500, "An error occured while creating transaction, login in to your account and try again",
                                                 "Error creating transaction", false));
            }

            await _bankingService.SaveAccountRecord((long)secondParty.Id, userTransactionDto.SecondPartyBankingDetails);

            var transaction = new Transaction()
            {
                Code        = await GenerateTransactionCode(),
                ProductName = userTransactionDto.ProductName,
                Category    = userTransactionDto.Category,
                Charges     = userTransactionDto.Charges,
                Description = userTransactionDto.Description,
            };

            if (userTransactionDto.SecondPartyAs.ToLower().Equals("merchant"))
            {
                transaction.Merchant = secondParty;
                transaction.Buyer    = user;
            }
            else
            {
                transaction.Buyer    = secondParty;
                transaction.Merchant = user;
            }

            _transRepo.AddTransaction(transaction);
            var isUpdated = await _transRepo.SaveChanges();

            if (!isUpdated)
            {
                return(new ApiResponseDto <bool>(500, "An error occured while creating transaction, login in to your account and try again",
                                                 "Error creating transaction", false));
            }

            await _mailingServices.SendTransactionMail(user, secondParty);

            await _mailingServices.SendTransactionMail(secondParty, user);

            return(new ApiResponseDto <bool>(200, "Transaction successfully created, check your email for transaction details", null, true));
        }