Complete integration to Data Base

Make refactoring of base entities and packages. Complete integration to
Data Base.