I have a web application and when the users clicks save, a write to a file should occur. The application is "a football scheduler", thus more than one players can click on the save button at the very same time.

Initially I thought that this would be something rare, but this is not the case, since when the match in announced players rush into, because the match will be full in a short period of time.

What happens if two players press save at the same time? Only the save of one player will take effect and the other one will be lost (and it is not rare that this happens with the last available position and then there is some conflict).

How can I cope with this phenomenon?

// removed code since it wasn't needed

---

I would like to know if this is possible without using a database. So a no answer is also accepted.