protected function deleteAlbumDir() {
		$tmpfile = new ElggFile();
		$tmpfile->setFilename('image/' . $this->guid . '/._tmp_del_tidypics_album_');
		$tmpfile->subtype = TidypicsImage::SUBTYPE;
		$tmpfile->owner_guid = $this->owner_guid;
		$tmpfile->container_guid = $this->guid;
		$tmpfile->open("write");
		$tmpfile->write('');
		$tmpfile->close();
		$tmpfile->save();
		$albumdir = preg_replace('#/._tmp_del_tidypics_album_#i', '', $tmpfile->getFilenameOnFilestore());
		$tmpfile->delete();

		// sanity check: must be a directory
		if (!$handle = opendir($albumdir)) {
			return false;
		}

		// loop through all files that might still remain undeleted in this directory and delete them
		// note: this does not delete the corresponding image entities from the database
		while (($file = readdir($handle)) !== false) {
			if (in_array($file, ['.', '..'])) {
				continue;
			}
			$path = "$albumdir/$file";
			unlink($path);
		}

		// remove empty directory
		closedir($handle);
		return rmdir($albumdir);
	}