public function saveStack(Stack $stack, array $requestConfig = [])
    {
        if (empty($stack->getName())) {
            throw new \LogicException('Stack has no name, please set one.');
        }
        if (empty($stack->getOrganization())) {
            $stack->setOrganization($this->defaultOrganization);
        }

        $queryString = [];
        if (isset($requestConfig['overwrite']) && true === $requestConfig['overwrite']) {
            $queryString['overwrite'] = 'true';
        }
        $contents = $this
            ->call(
                'PUT',
                implode('/', [self::STACK_RESOURCE, $stack->getOrganization(), $stack->getName()]),
                ['json' => $stack->getConfig(), 'query' => $queryString]
            )
            ->getBody()
            ->getContents();

        return Stack::createFromJsonResponse($contents);
    }