I made the code more passive, avoiding issued at taking, returning,
storing alerts or removing alerts from an item.
Now they all check if it is with you before returning/deleting
alert etc. I am not sure if all cases are covered, but they are
better than before. I had one only issued on this on that time,
but I prefer to prioritize safety/security.
I took the opportunitie to move some code from Controllers to
the model itself, as they were changing with the DB.
It happend once: a user asked to be added to the waiting
list at the same time other user was returning the item.
So the user ended up waiting for the user he was already
using.
The TakeController was manually sending the email message
as well as dealing with item return, so I moved the email message
to it's own listener, I created an event for it and moved the
return part to the item model.