Couldn't this be while(result2.HttpStatusCode != 412) ? We're either throwing or returning if it's not 412, but it seems clearer to put this condition here instead of while(true). (In general, I like to avoid while(true) as much as possible)