public function serialize(CurrentState $state, $outputStream)
    {
        $statusLeaseInfo = [
            'StatusLease' => [
                '@attributes' => [
                    'ClientId' => $state->getClientId(),
                ],
            ],
        ];

        if ($state instanceof AcquireCurrentState) {
            $statusLeaseInfo['StatusLease']['Acquire'] = [
                'Incarnation' => $state->getIncarnation(),
                'Status' => $state->getStatus(),
                'Expiration' => Utilities::isoDate(
                    date_timestamp_get($state->getExpiration())
                ),
            ];
        } elseif ($state instanceof ReleaseCurrentState) {
            $statusLeaseInfo['StatusLease']['Release'] = [];
        }

        $currentState = Utilities::serialize($statusLeaseInfo, 'CurrentState');
        fwrite($outputStream, $currentState);
    }