I thought about this approach, but I don't know how avoid new object allocation here.