title: Firebase Android - how to add value into DB only if condition is met?
body: <p>I'm writing a simple app in which users can enroll for a specific course, but only when there is enough place. 
  So a course would have a list of participants and a maximum participants number. The code that updates the participants list should do that only if the current  participants list size is less than the max participants number. I'm going to disable the UI, if the list gets full an no more people can enroll, but still there will be some rare cases when it doesn't update fast enough and people would still click and enroll themselves. So I guess there should be some kind of a check on the database side? How can I achieve a behavior like this in Firebase? </p>