refactoring working with db
refactoring working with db