public FixedIncomeProfileModel GetProfiles_Client()
        {
            Client client = edisRepo.GetClientSync(User.Identity.GetUserId(), DateTime.Now);
            ClientGroup clientGroup = edisRepo.GetClientGroupSync(client.ClientGroupId, DateTime.Now);
            if (clientGroup.MainClientId == client.Id)
            {
                List<GroupAccount> groupAccounts = edisRepo.GetAccountsForClientGroupSync(clientGroup.ClientGroupNumber, DateTime.Now);
                List<ClientAccount> clientAccounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now);

                FixedIncomeProfileModel model = new FixedIncomeProfileModel { data = new List<FixedIncomeProfileItem>() };

                List<AssetBase> assets = new List<AssetBase>();
                foreach (var account in groupAccounts)
                {
                    assets.AddRange(account.GetAssetsSync());
                }
                foreach (var account in clientAccounts)
                {
                    assets.AddRange(account.GetAssetsSync());
                }
                var incomes = assets.OfType<FixedIncome>();
                foreach (var income in incomes)
                {
                    FixedIncomeProfileItem item = new FixedIncomeProfileItem
                    {
                        ticker = income.Ticker,
                        fixedIncomeName = income.FixedIncomeName,
                        faceValue = income.LatestPrice,
                        coupon = income.CouponRate == null ? 0 : (double)income.CouponRate,
                        couponFrequency = income.CouponFrequency.ToString(),
                        issuer = income.Issuer,
                        costValue = income.GetCost().AssetCost,
                        totalCostValue = income.GetCost().Total,
                        marketValue = income.GetTotalMarketValue(),
                        priority = (int)income.BoundDetails.Priority,
                        redemptionFeatures = income.BoundDetails.RedemptionFeatures.ToString(),
                    };
                    model.data.Add(item);
                }

                return model;

            }
            else
            {
                List<ClientAccount> accounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now);
                FixedIncomeProfileModel model = new FixedIncomeProfileModel { data = new List<FixedIncomeProfileItem>() };

                List<AssetBase> assets = new List<AssetBase>();
                foreach (var account in accounts)
                {
                    assets.AddRange(account.GetAssetsSync());
                }
                var incomes = assets.OfType<FixedIncome>();
                foreach (var income in incomes)
                {
                    FixedIncomeProfileItem item = new FixedIncomeProfileItem
                    {
                        ticker = income.Ticker,
                        fixedIncomeName = income.FixedIncomeName,
                        faceValue = income.LatestPrice,
                        coupon = income.CouponRate == null ? 0 : (double)income.CouponRate,
                        couponFrequency = income.CouponFrequency.ToString(),
                        issuer = income.Issuer,
                        costValue = income.GetCost().AssetCost,
                        totalCostValue = income.GetCost().Total,
                        marketValue = income.GetTotalMarketValue(),
                        priority = (int)income.BoundDetails.Priority,
                        redemptionFeatures = income.BoundDetails.RedemptionFeatures.ToString(),
                    };
                    model.data.Add(item);
                }

                return model;

            }
        }
 public FixedIncomeProfileModel GenerateProfile(List<AssetBase> assets) {
     FixedIncomeProfileModel model = new FixedIncomeProfileModel { data = new List<FixedIncomeProfileItem>() };
     foreach (var income in assets.OfType<FixedIncome>()) {
         FixedIncomeProfileItem item = new FixedIncomeProfileItem {
             ticker = income.Ticker,
             fixedIncomeName = income.FixedIncomeName,
             faceValue = income.LatestPrice,
             coupon = income.CouponRate == null ? 0 : (double)income.CouponRate,
             couponFrequency = income.CouponFrequency.ToString(),
             issuer = income.Issuer,
             costValue = income.GetCost().AssetCost,
             totalCostValue = income.GetCost().Total,
             marketValue = income.GetTotalMarketValue(),
             priority = (int)income.BoundDetails.Priority,
             redemptionFeatures = income.BoundDetails.RedemptionFeatures.ToString(),
             bondRating = (double)income.BoundDetails.BondRating,
             ratingAgency = income.BoundDetails.RatingAgency,
         };
         model.data.Add(item);
     }
     return model;
 }