protected function setCloudApiClient($key, $secret) {
    try {
      $connector = new Connector(array(
        'key' => $key,
        'secret' => $secret,
      ));
      $cloud_api = Client::factory($connector);
      // We must call some method on the client to test authentication.
      $cloud_api->applications();
      $this->cloudApiClient = $cloud_api;
      return $cloud_api;
    }
    catch (\Exception $e) {
      // @todo this is being thrown after first auth. still works? check out.
      $this->logger->error('Failed to authenticate with Acquia Cloud API.');
      $this->logger->error('Exception was thrown: ' . $e->getMessage());
      return NULL;
    }
  }