Extracting nested Ifs to method