title: Prevent race-condition in RESTful api in certain scenario
body: <p>I'm currently developing an online course system where students can choose any course and enroll to it. The course will be held one-to-one principle so student will choose a certain date for the course and on that date, there will be an online video meeting with the instructor. Only one instructor and one student for each course session.
  Typical use-case flow is:</p>
  <ul>
  <li>Student press &quot;Enroll&quot; button and proceeds to the next page.</li>
  <li>On this page, student chooses the course date from the calendar (only from available dates) and proceeds to checkout page.</li>
  <li>On checkout page, student enters his/her card details and certain amount charged from student.</li>
  </ul>
  <p>A race condition may occur in this scenario (let's say there are only 2 users and 1 instructor):</p>
  <ul>
  <li>User1 chooses date from the calendar and proceeds to the checkout page.</li>
  <li>Meanwhile User2 also chooses exactly same date and proceeds to checkout page.</li>
  <li>User2 enters card details faster that User1 and reserves that date.</li>
  <li>User1 enters card details and system charges both students and BINGO (there are two students for the same date).</li>
  </ul>
  <p>I don't want to check date availability before payment so I think It'll give a bad user experience so the User must go to the previous step again and choose another date. Even this could happen infinitely :)</p>
  <p>Any ideas will be welcomed.
  Also, I can change the current enrollment flow to protect security.</p>