Copy from bitstarter-ssjs-db