var baseData = await q.Skip(request.SkipCount).Take(request.MaxResultCount).ToListAsync();
var q2 = from t in baseData
join a in await _customerManager.GetAllAgentFromCacheAsync() on t.OldAgentCode equals a.MustKod into oldAgent
from a in oldAgent.DefaultIfEmpty()
join aNew in await _customerManager.GetAllAgentFromCacheAsync() on t.NewAgentCode equals aNew.MustKod into newAgent
from aNew in newAgent.DefaultIfEmpty()
join p in _planRepository.GetAll() on t.PlanId equals p.Id into plan
from p in plan.DefaultIfEmpty()
join pr in _productRepository.GetAll() on t.ProductId equals pr.Id into product
from pr in product.DefaultIfEmpty()
join ph in _customerManager.GetAllMusteri() on
new { MustKod = t.PolicyHolderMustKod, KaynakKodu = t.OldSourceCode, SubeKod = t.OldBranchCode }
equals
new { ph.MustKod, ph.KaynakKodu, ph.SubeKod } into holder
from ph in holder.DefaultIfEmpty()
select new AgencyPortfolioTransferDto()
{
Id = t.Id,
OldAgentName = a?.Isim,
NewAgentName = aNew?.Isim,
ProductName = pr.ToString(),
PlanName = p?.DisplayNameWithIdAndCode,
MustKod = t.PolicyHolderMustKod,
PolicyHolderName = t.PolicyHolderMustKod,
StartDate = t.StartDate,
EndDate = t.EndDate,
};