Fix check for duplicate-ticket

 - Fix error-reporting
 - Implement unittest (this is how you realise these things)
Properly check for invalid parameters.
Implement Unittest for DeleteMethod

 - Proper checking of parameters
 - Return error if key does not exist