Sql objects refactoring