[DB] Refactor code .