Extract db repair (refactor)

Refactor database tables checking and repair to it's own class out of the Storage class.
Database check shows what needs to be changed now.