public bool IsValid(PostingEngineEnvironment env, Transaction element) { if (element.AccrualId == null) { return(true); } var validAccrual = env.IsValidAccrual(element.AccrualId); if (!validAccrual) { env.AddMessage($"trade does not tie back to a valid accrual {element.AccrualId}"); } return(validAccrual); }