Added a transaction in threads.php delete() method