# Scheduled permanent deletion of items in the Recycle bin

When a data item is sent to the *Recycle bin* through the `IRecycleBinService`, a scheduled task for its permanent deletion is created. The scheduled task is of type `PermanentDeleteTask` and contains a serialized information needed to identify the `RecycleBinDataItem` to be used for permanent deletion and the due date of the task.

Since the permanent deletion tasks are tightly coupled with the existing `RecycleBinDataItems`, there is an abstraction layer for recreating or deleting permanent delete tasks named `IPermanentDeleteTaskService`. Following is an example how to recreate all scheduled tasks or permanent delete of all existing `RecycleBinData` items. This happens every time the retention policy for items in the *Recycle bin* is changed from the configurations screen since the due date for the task is set on its creation.

```C#
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.RecycleBin.ScheduledTasks;

namespace SitefinityWebApp
{
   public class SchedulePermanentDelete
   {
       public void SchedulePermanentDeleteRB()
       {
           IPermanentDeleteTaskService permanentDeleteTaskService = ObjectFactory.Resolve<IPermanentDeleteTaskService>();
           permanentDeleteTaskService.DeleteAllTasks();
           permanentDeleteTaskService.CreateTasksForAllRecycleBinItems();
       }
   }
}
```
