refactor publishpartitions method
remove unused imports and throw an exception if it is not able to delete a partition