/**
  * checkout
  *
  * @param $profile
  *
  * @return bool
  * @throws \Exception
  */
 public function checkout($profile)
 {
     $listModel = new ProfilesModel();
     $profiles = $listModel->getList();
     if (!in_array($profile, $profiles)) {
         throw new \Exception(sprintf('Profile "%s" not exists.', $name));
     }
     $profileConfig = new Registry();
     $file = JPATH_ROOT . '/tmp/sqlsync/config.yml';
     $profileConfig->loadFile($file);
     $profileConfig->set('profile', $profile);
     $content = $profileConfig->toString('yaml');
     if (!\JFile::write($file, $content)) {
         throw new \Exception('Writing profile config fail.');
     }
     return true;
 }