public function objectRestore($iObjectId)
    {
        $oDb = Factory::service('Database');

        try {

            $oObject = $this->getObjectFromTrash($iObjectId);
            if (empty($oObject)) {
                throw new CdnException('Not a valid object');
            }

            // --------------------------------------------------------------------------

            $aObjectData = [
                'id'               => $oObject->id,
                'bucket_id'        => $oObject->bucket->id,
                'filename'         => $oObject->file->name->disk,
                'filename_display' => $oObject->file->name->human,
                'mime'             => $oObject->file->mime,
                'filesize'         => $oObject->file->size->bytes,
                'img_width'        => $oObject->img_width,
                'img_height'       => $oObject->img_height,
                'img_orientation'  => $oObject->img_orientation,
                'is_animated'      => $oObject->is_animated,
                'serves'           => $oObject->serves,
                'downloads'        => $oObject->downloads,
                'thumbs'           => $oObject->thumbs,
                'scales'           => $oObject->scales,
                'driver'           => $oObject->driver,
                'created'          => $oObject->created,
                'created_by'       => $oObject->created_by,
            ];

            if (isLoggedIn()) {
                $aObjectData['modified_by'] = activeUser('id');
            }

            $oDb->set($aObjectData);
            $oDb->set('modified', 'NOW()', false);

            //  Start transaction
            $oDb->trans_begin();

            //  Restore object
            if (!$oDb->insert(NAILS_DB_PREFIX . 'cdn_object')) {
                throw new CdnException('Failed to restore original object.');
            }

            //  Remove trash object
            $oDb->where('id', $oObject->id);
            if (!$oDb->delete(NAILS_DB_PREFIX . 'cdn_object_trash')) {
                throw new CdnException('Failed to remove the trash object.');
            }

            $oDb->trans_commit();

            return true;

        } catch (\Exception $e) {
            $oDb->trans_rollback();
            $this->setError($e->getMessage());
            return false;
        }
    }