public function ensureParameters($parameters = array(), $method) {
    if (empty($parameters) || empty($method)) {
      throw new MissingParameterException(sprintf('%s called without required parameters.', __METHOD__));
    }
    foreach ($parameters as $parameter => $value) {
      if (!isset($value)) {
        throw new MissingParameterException(sprintf('Missing required %s parameter in %s', $parameter, $method));
      }
    }
  }