Architecture refactoring. Write optional columns into DB.

Resolves Ignotus/moh#2