Refactored db entities