title: CoreData Exc_bad_access code=1 with Sub Entity
body: <p>I need your help, I still have an beautiful <code>EXC_BAD_ACCESS</code> error on this line <code>self.clinic!.copyWithDTO(clinicDTO)</code>.</p>
  
  <p>Console : <code>po self.clinic</code></p>
  
  <pre><code>Optional(&lt;NSManagedObject: 0x7a7bd240&gt; (entity: Clinic; id: 0x7a7bbe10 &lt;x-coredata://7B916AD3-1989-426F-932F-0A62C755F2B4/Clinic/p1&gt; ; data: &lt;fault&gt;))
  </code></pre>
  
  <p>I'm trying to fill properties on a sub entity in CoreData model by giving a DTO.</p>
  
  <pre><code>@objc(UserProfile)
  class UserProfile: BaseStoredObject {
  
      override class func entityName() -&gt; String {
          return "UserProfile"
      }
  
      override func copyWithDTO(dto: BaseDTO) {
          if let userProfileDTO = dto as? UserProfileDTO {
              self.id = userProfileDTO.id
              self.login = userProfileDTO.login
              self.password = userProfileDTO.password
              self.lastname = userProfileDTO.lastname
              self.email = userProfileDTO.email
              self.createdOn = userProfileDTO.createdOn
              self.gender = userProfileDTO.gender
              self.userProfileType = userProfileDTO.userProfileType
              self.firstname = userProfileDTO.firstname
              self.fullname = userProfileDTO.fullname
              if let clinicDTO = userProfileDTO.clinic {
                  if let unwrappedClinic = self.clinic {
                      unwrappedClinic.copyWithDTO(clinicDTO)
                  } else {
                      self.clinic = Clinic(entity: NSEntityDescription.entityForName("Clinic", inManagedObjectContext: self.managedObjectContext!)!, insertIntoManagedObjectContext: self.managedObjectContext)
                      self.clinic!.copyWithDTO(clinicDTO) //  !! EXC_BAD_ACCESS (code=1, address=0x....)
                  }
  
              }
          } else {
              fatalError("copyWithDTO: must be sent with UserProfileDTO")
          }
      }
  
  }
  
  @objc(Clinic)
  class Clinic: BaseStoredObject {
  
      override class func entityName() -&gt; String {
          return "Clinic"
      }
  
      override func copyWithDTO(dto: BaseDTO) {
          if let clinicDTO = dto as? ClinicDTO {
              self.id = clinicDTO.id
              self.name = clinicDTO.name
              self.phoneNumber = clinicDTO.phoneNumber
              self.phoneNumber24hours = clinicDTO.phoneNumber24hours
              self.nurseContactPhoneNumber = clinicDTO.nurseContactPhoneNumber
              self.emergencyPhoneNumber = clinicDTO.emergencyPhoneNumber
              self.internalClinicId = clinicDTO.internalClinicId
              self.webserviceURL = ""
          } else {
              fatalError("copyWithDTO: must be sent with ClinicDTO")
          }
      }
  
  }
  
  
  extension UserProfile {
  
      @NSManaged var id: String?
  
      @NSManaged var login: String?
      @NSManaged var password: String?
      @NSManaged var lastname: String?
      @NSManaged var firstname: String?
      @NSManaged var email: String?
      @NSManaged var createdOn: NSDate?
      @NSManaged var userProfileType: NSNumber?
      @NSManaged var gender: NSNumber?
      @NSManaged var fullname: String?
  
      @NSManaged var clinic: Clinic?
  
  }
  </code></pre>
  
  <p>What I'm doing wrong ?</p>
  
  <p>Thank you ;)</p>
  
  <p><strong>EDIT:</strong> <code>BaseStoredObject</code> is a subclass of <code>NSManagedObject</code></p>