title: MVC design - handle file upload before saving the record
body: <p>We've an MVC web app which has a Claim management wizard (similar to a typical Order entry stuff). Claim can have multiple Items and each Item can have multiple files related to it.</p>
  
  <blockquote>
    <p>Claim --> Items --> Files</p>
  </blockquote>
  
  <p>While adding a new Claim - we want to allow the user to add one or more items to it and also allow file upload for those items. But we want to keep everything in memory until the Claim is actually saved - so that if the user doesn't complete the Claim entry or discards it, no database interaction is done.</p>
  
  <p>We're able to handle data level in-memory management via session. We serialize the Claim object (which also includes a Claim.Items property) in session. But how to manage files? </p>
  
  <blockquote>
    <p>We store files in &lt; ClaimID >\&lt; ItemID > folder but while creating a new
    claim in memory we don't have any IDs until the record is being
    saved in the database (both are auto-increment int).</p>
  </blockquote>
  
  <p>For now, we've to restrict the user from uploading files until a Claim is saved.</p>