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

Fixes #14 
Currently it will just check for duplicates once. What if a duplicated code is generated twice?

You probably don't want `unless` here, but `until`.