Extract db remove code