This method contains a large amount of logic, but there don't appear to be any tests for it. A quick scan over it makes me think that there are around 13 different branches that are doing something "interesting" that need to be tested.