private static ChequeVoucherDTO CastAsCheckDTO(dynamic byf, ByfCache cache)
        {
            var req = new FundRequestDTO
            {
                Id           = As.ID(byf.nid),
                Amount       = As.Decimal_(byf.checkamountactual),
                SerialNum    = As.ID_(byf.serial) ?? 0,
                DateOffset   = As.DateOffset(byf.requestdate),
                Payee        = (string)As.Text(byf.adhocpayee),
                Purpose      = As.Text(byf.description),
                Remarks      = As.Text(byf.remarks),
                ChequeStatus = GetChequeStatus(byf),
                Allocations  = new List <AccountAllocation>()
            };

            var cleared = (DateTime?)As.Date_(byf.cleareddate);

            if (cleared.HasValue)
            {
                cache.ClearedDatesById[req.Id] = cleared.Value;
            }

            if (req.Payee.IsBlank())
            {
                req.Payee = cache.PayeeById(As.ID(byf.savedpayeenid));
            }

            return(new ChequeVoucherDTO
            {
                Id = req.Id,
                Request = req,
                ChequeDate = As.Date_(byf.checkdate) ?? DateTime.MinValue,
                ChequeNumber = As.ID_(byf.checknumber) ?? 0,
                IssuedDate = As.Date_(byf.issueddate),
                IssuedTo = As.Text(byf.issuedto),
                Remarks = req.Remarks,
            });
        }