Made ValueOfQuantity database friendly

Contributes to #6