private function consume(array $data, array $context)
    {
        foreach ($context as $property => $value) {
            $sanitized = $this->validateValue($value);
            if ($sanitized === null) {
                continue;
            }

            if (in_array($property, [MessageInterface::SERVER_IP, MessageInterface::USER_IP], true)) {
                try {
                    $ip = new IP($value);
                    $value = $ip->getShortAddress();
                } catch (InvalidIpAddressException $e) {
                    $value = '0.0.0.0';
                }
            }

            if (in_array($property, $this->knownProperties, true)) {
                $data[$property] = $sanitized;

            } else {
                $data[MessageInterface::CONTEXT][$property] = $sanitized;
            }
        }

        return $data;
    }