public static function addParameters(QueryBuilder $queryBuilder, $parameters)
    {
        /*
         * No parameters?
         * Nothing to do
         */
        if (empty($parameters)) {
            return $queryBuilder;
        }

        foreach ($parameters as $key => $parameter) {
            $name = $key;
            $value = $parameter;

            if ($parameter instanceof Parameter) {
                $name = $parameter->getName();
                $value = $parameter->getValue();
            }

            $queryBuilder->setParameter($name, $value);
        }

        return $queryBuilder;
    }