We were talking about this at work the other day - how do you solve a problem like double booking a hotel room or a car hire (or, for that matter, Maria)?
There are various solutions, but a dead easy one it laid out in the textbook we give our sixth form AS students. If you had that book in front of you then you'd go to page 193 and find that it was quite complex looking, but really dead easy. There needs to be some thinking done as to how exactly to get it work of course, but we'll get there with that. Perhaps.
I'll add some screenshots to this when I get the chance.