def serialize_resource_set_to_hash_single(resource_set)

      primary_objects = []
      included_objects = []

      resource_set.resource_klasses.each_value do |resource_klass|
        resource_klass.each_value do |resource|
          serialized_resource = object_hash(resource[:resource], resource[:relationships])

          if resource[:primary]
            primary_objects.push(serialized_resource)
          else
            included_objects.push(serialized_resource)
          end
        end
      end

      fail "To Many primary objects for show" if (primary_objects.count > 1)
      primary_hash = { 'data' => primary_objects[0] }

      primary_hash['included'] = included_objects if included_objects.size > 0
      primary_hash
    end
def serialize_resource_set_to_hash_single(resource_set)

      primary_objects = []
      included_objects = []

      resource_set.resource_klasses.each_value do |resource_klass|
        resource_klass.each_value do |resource|
          serialized_resource = object_hash(resource[:resource], resource[:relationships])

          if resource[:primary]
            primary_objects.push(serialized_resource)
          else
            included_objects.push(serialized_resource)
          end
        end
      end

      fail "To Many primary objects for show" if (primary_objects.count > 1)
      primary_hash = { 'data' => primary_objects[0] }

      primary_hash['included'] = included_objects if included_objects.size > 0
      primary_hash
    end
initialize
 Options can include
 include:
     Purpose: determines which objects will be side loaded with the source objects in a linked section
     Example: ['comments','author','comments.tags','author.posts']
 fields:
     Purpose: determines which fields are serialized for a resource type. This encompasses both attributes and
              relationship ids in the links section for a resource. Fields are global for a resource type.
     Example: { people: [:id, :email, :comments], posts: [:id, :title, :author], comments: [:id, :body, :post]}
 key_formatter: KeyFormatter instance to override the default configuration
 serialization_options: additional options that will be passed to resource meta and links lambdas
 Converts a resource_set to a hash, conforming to the JSONAPI structure