Moved Database related code to DAOs

Also annotated the parameters as @Nonnull or @Nullable
Add missing license headers
Document the content filters
Add some more documentation