diff --git a/src/Adapter/BackupDatabaseLocalAdapter.php b/src/Adapter/BackupDatabaseLocalAdapter.php
index 5337ce7..3efb39f 100755
--- a/src/Adapter/BackupDatabaseLocalAdapter.php
+++ b/src/Adapter/BackupDatabaseLocalAdapter.php
@@ -9,6 +9,7 @@ namespace Drupal\backup_db\Adapter;
 
 use Drupal\backup_db\Adapter\BackupDatabaseAdapterInterface;
 use Drupal\backup_db\BackupDatabaseClientInterface;
+use Drupal\file\Entity\File;
 
 /**
  * BackupDatabaseLocalAdapter class.
@@ -38,11 +39,11 @@ class BackupDatabaseLocalAdapter implements BackupDatabaseAdapterInterface {
     $user = \Drupal::currentUser();
 
     // Create a file entity.
-    $entity = entity_create('file', array(
+    $entity = File::create([
       'uri' => $file->getFileUri(),
       'uid' => $user->id(),
       'status' => FILE_STATUS_PERMANENT,
-    ));
+    ]);
     $entity->save();
 
     // Insert history entry.
diff --git a/src/BackupDatabaseFileHandler.php b/src/BackupDatabaseFileHandler.php
index 909dc81..82b9751 100755
--- a/src/BackupDatabaseFileHandler.php
+++ b/src/BackupDatabaseFileHandler.php
@@ -9,6 +9,7 @@ namespace Drupal\backup_db;
 
 use Drupal\Core\File\FileSystem;
 use Drupal\backup_db\BackupDatabaseFile;
+use Drupal\Core\File\FileSystemInterface;
 
 /**
  * BackupDatabaseFileHandler class.
@@ -54,7 +55,7 @@ class BackupDatabaseFileHandler {
     $extension = $this->createFileType();
 
     $this->file->setFileName($this->config['name'] . '_' . time() . $extension);
-    $this->file->setFileUri(file_create_filename(
+    $this->file->setFileUri(createFilename(
       $this->file->getFileName(), $path
     ));
   }
@@ -103,7 +104,7 @@ class BackupDatabaseFileHandler {
   private function createFilePath() {
     $result = $this->config['path'];
 
-    if (!file_prepare_directory($result, FILE_CREATE_DIRECTORY)) {
+    if (!prepareDirectory($result, FILE_CREATE_DIRECTORY)) {
       $result = FALSE;
 
       \Drupal::logger('backup_db')->error('The requested directory @dir could not be created.',
@@ -112,7 +113,7 @@ class BackupDatabaseFileHandler {
         )
       );
     }
-    else if (!file_prepare_directory($result)) {
+    else if (!prepareDirectory($result)) {
       $result = FALSE;
 
       \Drupal::logger('backup_db')->error('The requested directory @dir permissions are not writable.',
@@ -125,7 +126,7 @@ class BackupDatabaseFileHandler {
     if ($this->config['date']) {
       $filepath = $this->config['path'] . '/' . $this->config['date'];
 
-      if (file_prepare_directory($filepath, FILE_CREATE_DIRECTORY)) {
+      if (prepareDirectory($filepath, FILE_CREATE_DIRECTORY)) {
         $result = $filepath;
       }
     }
diff --git a/src/Controller/BackupDatabaseController.php b/src/Controller/BackupDatabaseController.php
index 3c0b983..6e3013a 100755
--- a/src/Controller/BackupDatabaseController.php
+++ b/src/Controller/BackupDatabaseController.php
@@ -9,6 +9,7 @@ namespace Drupal\backup_db\Controller;
 
 use Drupal\Core\Url;
 use Drupal\Core\Controller\ControllerBase;
+use Drupal\Core\Link;
 
 /**
  * Display database backup history.
@@ -19,7 +20,7 @@ class BackupDatabaseController extends ControllerBase {
    * {@inheritdoc}
    */
   public function historyOverview() {
-    $query = db_select('backup_db', 'e');
+    $query = \Drupal::database()->select('backup_db', 'e');
     $count_query = clone $query;
     $count_query->addExpression('Count(e.eid)');
 
@@ -37,7 +38,7 @@ class BackupDatabaseController extends ControllerBase {
     $rows = array();
     foreach ($results as $result) {
       $url = backup_db_link($result->uri);
-      $location = \Drupal::l($result->uri, Url::fromUri('base:/'.file_create_url($url)));
+      $location = Link::fromTextAndUrl($result->uri, Url::fromUri('base:/'.file_create_url($url)));
       $created = \Drupal::service('date.formatter')->format($result->created, 'html_date');
 
       $rows[$result->fid] = array(
diff --git a/src/Form/BackupDatabaseForm.php b/src/Form/BackupDatabaseForm.php
index e9ba957..ab8478a 100755
--- a/src/Form/BackupDatabaseForm.php
+++ b/src/Form/BackupDatabaseForm.php
@@ -89,10 +89,10 @@ class BackupDatabaseForm extends FormBase {
 
     // Run the export.
     if ($handler->export()) {
-      drupal_set_message(t('Backup has been successfully completed.'), 'status');
+      $this->messenger->addStatus(t('Backup has been successfully completed.'));
     }
     else {
-      drupal_set_message(t('Backup has failed, please review recent log messages.'), 'warning');
+      $this->messenger->addWarning(t('Backup has failed, please review recent log messages.'));
     }
   }
 }
diff --git a/src/Form/BackupDatabaseSettingsForm.php b/src/Form/BackupDatabaseSettingsForm.php
index 475c042..9597b00 100755
--- a/src/Form/BackupDatabaseSettingsForm.php
+++ b/src/Form/BackupDatabaseSettingsForm.php
@@ -211,7 +211,7 @@ class BackupDatabaseSettingsForm extends ConfigFormBase {
       }
       else {
         // Warn user that it should be private.
-        drupal_set_message(t('Private directory is not set and should be used for backup storage.'), 'warning');  
+        $this->messenger->addWarning(t('Private directory is not set and should be used for backup storage.'));  
       }
     }
   }
