It feels like this conversion is sufficiently complex to extract into a separate method