It might be a bit cleaner if you use `XDocument` instead, but this is already written and it's okay the way it is so only change it if you want to.