This can be made a function (rather than a method) and should be robustly unit-tested on its own.