handle database overwrite

Signed-off-by: Luca Lianas <lucalianas@gmail.com>
bugfix
renamed invalid URLs exception
minor refactory
database overwrite not allowed
added add\get\delete document methods (and tests)