title: Refactor nested IF statement for clarity
body: <p>I want to refactor this mumbo jumbo of a method to make it more readible, it has way to many nested IF's for my liking.</p>
  
  <p>How would you refactor this?</p>
  
  <pre><code>public static void HandleUploadedFile(string filename)
  {
    try
    {
      if(IsValidFileFormat(filename)
      {
        int folderID = GetFolderIDFromFilename(filename);
        if(folderID &gt; 0)
        {
          if(HasNoViruses(filename)
          {
            if(VerifyFileSize(filename)
            {
              // file is OK
              MoveToSafeFolder(filename);
            }
            else
            {
              DeleteFile(filename);
              LogError("file size invalid");
            }
          }
          else
          {
            DeleteFile(filename);
            LogError("failed virus test");
          }
        }
        else
        {
          DeleteFile(filename);
          LogError("invalid folder ID");
        }
      }
      else
      {
        DeleteFile(filename);
        LogError("invalid file format");
      }
    }
    catch (Exception ex)
    {
      LogError("unknown error", ex.Message);
    }
    finally
    {
      // do some things
    }
  }
  </code></pre>