Extract the check for XML content type out to a method