                 properties[key] = propertyDescription
                 
                 return properties
-        }
+            }
     }
-    
+}
+
+/// MARK: Relationships
+extension NSEntityDescription {
     public var relationships: [NSRelationshipDescription] {
         return properties.flatMap { $0 as? NSRelationshipDescription }
     }

        return remoteProperties.flatMap { $0 as? NSAttributeDescription }
    }
    
    public func remoteAttributesByName(_ useLocalNames: Bool = false) -> [String: NSAttributeDescription] {
        return remoteAttributes
            .reduce([String: NSAttributeDescription]()) { remoteAttributesByName, attributeDescription in

                relationships[key] = relationshipDescription
                
                return relationships
            }
    }
}

/// MARK: Attributes
extension NSEntityDescription {
    public var attributes: [NSAttributeDescription] {
        return properties.flatMap { $0 as? NSAttributeDescription }
    }
