refactored to separate DBCollection extension from the actual schema function.