protected function registerSoftDelete(Mapper $mapper)
    {
        $entityMap = $mapper->getEntityMap();

        // Add Scopes
        $mapper->addGlobalScope(new SoftDeletingScope());

        // Register 'deleting' events
        $mapper->registerEvent('deleting', function ($event) use ($entityMap) {
            $entity = $event->entity;
            $wrappedEntity = $this->getMappable($entity);

            $deletedAtField = $entityMap->getQualifiedDeletedAtColumn();

            if (!is_null($wrappedEntity->getEntityAttribute($deletedAtField))) {
                return true;
            }

            $time = new Carbon();

            $wrappedEntity->setEntityAttribute($deletedAtField, $time);

            $plainObject = $wrappedEntity->getObject();
            $this->manager->mapper(get_class($plainObject))->store($plainObject);

            return false;
        });

        // Register RestoreCommand
        $mapper->addCustomCommand(Restore::class);
    }