How to create a case management database