public function setPermissions(Part $part, ChannelPermission $permissions = null)
    {
        $deferred = new Deferred();

        if ($part instanceof Member) {
            $type = 'member';
        } elseif ($part instanceof Role) {
            $type = 'role';
        } else {
            return false;
        }

        if (is_null($permissions)) {
            $permissions = $this->factory->create(ChannelPermission::class);
        }

        list($allow, $deny) = $permissions->bitwise;

        $payload = [
            'id'    => $part->id,
            'type'  => $type,
            'allow' => $allow,
            'deny'  => $deny,
        ];

        if (! $this->created) {
            $this->attributes['permission_overwrites'][] = $payload;
            $deferred->resolve();
        } else {
            $this->http->put("channels/{$this->id}/permissions/{$part->id}", $payload)->then(
                \React\Partial\bind_right($this->resolve, $deferred),
                \React\Partial\bind_right($this->reject, $deferred)
            );
        }

        return $deferred->promise();
    }