make metadata storage pluggable

we may want to create a method to check if a table exists, instead of repeating it.