Fix and refactor methods in database class. Add sites addition with unique code

Fixes #14 
There are not enough tests for this. Write one test for each case:

- a blank url is submitted
- a non-url value is submitted
- an url that already is in the DB is submitted