public function setParameters($subject, ParameterBagInterface $parameters)
    {
        if (!is_object($subject)) {
            throw new InvalidSubjectException($subject);
        }

        if ($subject instanceof ParameterBagAwareInterface) {
            $subject->setParameters($parameters);
        } else {
            foreach ($parameters as $key => $value) {
                $this->setParameter($subject, $key, $value);
            }
        }
    }