func (x *EligibilityResponse) UnmarshalJSON(data []byte) (err error) {
	x2 := eligibilityResponse{}
	if err = json.Unmarshal(data, &x2); err == nil {
		if x2.Contained != nil {
			for i := range x2.Contained {
				x2.Contained[i] = MapToResource(x2.Contained[i], true)
			}
		}
		*x = EligibilityResponse(x2)
		return x.checkResourceType()
	}
	return
}
Custom unmarshaller to properly unmarshal embedded resources (represented as interface{})
package models
import (
	"encoding/json"
	"errors"
	"fmt"
)
type EligibilityResponse struct {
	DomainResource                `bson:",inline"`
	Identifier                    []Identifier                           `bson:"identifier,omitempty" json:"identifier,omitempty"`
	Status                        string                                 `bson:"status,omitempty" json:"status,omitempty"`
	RequestIdentifier             *Identifier                            `bson:"requestIdentifier,omitempty" json:"requestIdentifier,omitempty"`
	RequestReference              *Reference                             `bson:"requestReference,omitempty" json:"requestReference,omitempty"`
	Outcome                       string                                 `bson:"outcome,omitempty" json:"outcome,omitempty"`
	Disposition                   string                                 `bson:"disposition,omitempty" json:"disposition,omitempty"`
	Ruleset                       *Coding                                `bson:"ruleset,omitempty" json:"ruleset,omitempty"`
	OriginalRuleset               *Coding                                `bson:"originalRuleset,omitempty" json:"originalRuleset,omitempty"`
	Created                       *FHIRDateTime                          `bson:"created,omitempty" json:"created,omitempty"`
	OrganizationIdentifier        *Identifier                            `bson:"organizationIdentifier,omitempty" json:"organizationIdentifier,omitempty"`
	OrganizationReference         *Reference                             `bson:"organizationReference,omitempty" json:"organizationReference,omitempty"`
	RequestProviderIdentifier     *Identifier                            `bson:"requestProviderIdentifier,omitempty" json:"requestProviderIdentifier,omitempty"`
	RequestProviderReference      *Reference                             `bson:"requestProviderReference,omitempty" json:"requestProviderReference,omitempty"`
	RequestOrganizationIdentifier *Identifier                            `bson:"requestOrganizationIdentifier,omitempty" json:"requestOrganizationIdentifier,omitempty"`
	RequestOrganizationReference  *Reference                             `bson:"requestOrganizationReference,omitempty" json:"requestOrganizationReference,omitempty"`
	Inforce                       *bool                                  `bson:"inforce,omitempty" json:"inforce,omitempty"`
	Contract                      *Reference                             `bson:"contract,omitempty" json:"contract,omitempty"`
	Form                          *Coding                                `bson:"form,omitempty" json:"form,omitempty"`
	BenefitBalance                []EligibilityResponseBenefitsComponent `bson:"benefitBalance,omitempty" json:"benefitBalance,omitempty"`
	Error                         []EligibilityResponseErrorsComponent   `bson:"error,omitempty" json:"error,omitempty"`
}
func (resource *EligibilityResponse) MarshalJSON() ([]byte, error) {
	resource.ResourceType = "EligibilityResponse"
	return json.Marshal(*resource)
}
func (x *EligibilityResponse) GetBSON() (interface{}, error) {
	x.ResourceType = "EligibilityResponse"
	return *x, nil
}
type eligibilityResponse EligibilityResponse