Refactoring of db tables structure