I would actually recommend using the collaboration system to do this, that way you get lots of code to reuse.
Currently there's only approval items available in the collaboration system, you can take a look at the code by opening the file kernel/classes/collaborationhandlers/ezapprove/ezapprovecollaborationhandler.php