     ]
   }
 
-  private func map(_ relationship: CoreData.Relationship) -> [String: Any] {
+  private func map(_ relationship: CoreData.Relationship, in model: CoreData.Model) -> [String: Any] {
     return [
       "name": relationship.name,
       "isIndexed": relationship.isIndexed,

  private func map(_ model: CoreData.Model) -> [String: Any] {
    return [
      "configurations": model.configurations,
      "entities": model.entities.mapValues(map),
      "fetchRequests": model.fetchRequests.map(map),
      "fetchRequestsByEntityName": model.fetchRequestsByEntityName.mapValues { $0.map(map) }
    ]
  }

  private func map(_ entity: CoreData.Entity) -> [String: Any] {
    return [
      "name": entity.name,
      "className": entity.className,
      "isAbstract": entity.isAbstract,
      "userInfo": entity.userInfo,
      "superentity": entity.superentity ?? "",
      "attributes": entity.attributes.map(map),
      "relationships": entity.relationships.map(map),
      "fetchedProperties": entity.fetchedProperties.map(map)
    ]
  }

  private func map(_ attribute: CoreData.Attribute) -> [String: Any] {
    return [
      "name": attribute.name,
      "isIndexed": attribute.isIndexed,

    ]
  }

  private func map(_ fetchedProperty: CoreData.FetchedProperty, in model: CoreData.Model) -> [String: Any] {
    return [
      "name": fetchedProperty.name,
      "isOptional": fetchedProperty.isOptional,
      "fetchRequest": map(fetchedProperty.fetchRequest, in: model),
      "userInfo": fetchedProperty.userInfo
    ]
  }

  private func map(_ fetchRequest: CoreData.FetchRequest, in model: CoreData.Model) -> [String: Any] {
    guard let entity = model.entities[fetchRequest.entity] else {
      return [:]
    }

    return [
      "name": fetchRequest.name,
      "entity": fetchRequest.entity,
      "fetchLimit": fetchRequest.fetchLimit,
      "fetchBatchSize": fetchRequest.fetchBatchSize,
      "predicateString": fetchRequest.predicateString,
      "substitutionVariables": substitutionVariables(
        in: fetchRequest.predicateString,
        baseEntity: entity,
        model: model
      ),
      "resultType": map(fetchRequest.resultType),
      "includeSubentities": fetchRequest.includeSubentities,
      "includePropertyValues": fetchRequest.includePropertyValues,
