Add entity. Refactor db