I think this method should handle one case at the time. And the test should be passing that one case here. At this moment I see that this method do too much different things: retrieve case, iterate, setup editor.