private void deleteEmptyDirectoryTree(String relativePath) throws IOException  {
        if (relativePath.trim().equals("")) {
            throw new IllegalArgumentException("Empty relativePath.");
        }

        File dir = new File(mRootDirectory, relativePath);
        if (!(dir.exists() && dir.isDirectory())) {
            return;
        }
        for (String subDir : dir.list()) {
            if (mIgnoreDirectories.contains(subDir) || subDir.trim().equals("")) {
                continue;
            }
            deleteEmptyDirectoryTree(String.format("%s/%s", relativePath, subDir));
        }
        // By the time we've recursed to here, all subdirectories should be empty.
        if (dir.exists() && dir.isDirectory()) {
            if (!dir.delete()) {
                throw new IOException(String.format("Couldn't remove: %s", relativePath));
            }
        }
    }