Hi Ntozier. This code already appears in the class.thread_actions.php file that i have. However i still have the issue of attachments being removed.
// Replace previous edit --------------------------
$original = $old->getParent();
// Link the new entry to the old id
$entry->pid = $old->pid;
// Drop the previous edit, and base this edit off the original
$old = $original;
// Move the attachments to the new entry
'object_id' => $entry->id
// Mark the new entry as edited (but not hidden nor guarded)
$entry->flags = ($old->flags & ~(ThreadEntry: | ThreadEntry:))
// Guard against deletes on future edit if requested. This is done
// if an email was triggered by the last edit. In such a case, it
// should not be replaced by a subsequent edit.
$entry->flags |= ThreadEntry:;