Refactored raw call of delete db api to method.

To ease future refactoring away.