public CloudEvent DecodeGenericRecord(GenericRecord record, IEnumerable <ICloudEventExtension> extensions = null)
        {
            if (!record.TryGetValue("attribute", out var attrObj))
            {
                return(null);
            }
            IDictionary <string, object> recordAttributes = (IDictionary <string, object>)attrObj;
            object data = null;

            if (!record.TryGetValue("data", out data))
            {
                data = null;
            }

            CloudEventsSpecVersion specVersion = CloudEventsSpecVersion.Default;
            var cloudEvent = new CloudEvent(specVersion, extensions);

            cloudEvent.Data = data;

            var attributes = cloudEvent.GetAttributes();

            foreach (var keyValuePair in recordAttributes)
            {
                // skip the version since we set that above
                if (keyValuePair.Key.Equals(CloudEventAttributes.SpecVersionAttributeName(CloudEventsSpecVersion.V0_1), StringComparison.InvariantCultureIgnoreCase) ||
                    keyValuePair.Key.Equals(CloudEventAttributes.SpecVersionAttributeName(CloudEventsSpecVersion.V0_2), StringComparison.InvariantCultureIgnoreCase) ||
                    keyValuePair.Key.Equals(CloudEventAttributes.SpecVersionAttributeName(CloudEventsSpecVersion.V1_0), StringComparison.InvariantCultureIgnoreCase))
                {
                    continue;
                }
                if (keyValuePair.Key == CloudEventAttributes.SourceAttributeName(specVersion) ||
                    keyValuePair.Key == CloudEventAttributes.DataSchemaAttributeName(specVersion))
                {
                    attributes[keyValuePair.Key] = new Uri((string)keyValuePair.Value);
                }
                else if (keyValuePair.Key == CloudEventAttributes.TimeAttributeName(specVersion))
                {
                    attributes[keyValuePair.Key] = Timestamps.Parse((string)keyValuePair.Value);
                }
                else
                {
                    attributes[keyValuePair.Key] = keyValuePair.Value;
                }
            }

            return(cloudEvent);
        }
 protected override DateTimeOffset ParseImpl(string value) => Timestamps.Parse(value);