def serialize_attribute(attrs, name, names, options)
      if relations.key?(name)
        value = send(name)
        attrs[name] = value ? value.serializable_hash(options) : nil
      elsif names.include?(name) && !fields.key?(name)
        attrs[name] = read_raw_attribute(name)
      elsif !attribute_missing?(name)
        attrs[name] = send(name)
      end
    end
def serialize_attribute(attrs, name, names, options)
      if relations.key?(name)
        value = send(name)
        attrs[name] = value ? value.serializable_hash(options) : nil
      elsif names.include?(name) && !fields.key?(name)
        attrs[name] = read_raw_attribute(name)
      elsif !attribute_missing?(name)
        attrs[name] = send(name)
      end
    end
Serialize a single attribute. Handles associations, fields, and dynamic
 attributes.

 @api private

 @example Serialize the attribute.
   document.serialize_attribute({}, "id" , [ "id" ])

 @param [ Hash ] attrs The attributes.
 @param [ String ] name The attribute name.
 @param [ Array<String> ] names The names of all attributes.
 @param [ Hash ] options The options.

 @return [ Object ] The attribute.

 @since 3.0.0