Added support to removeNotEmptyContext from which is needed to remove nested contexts which are not empty.