     case Save
 }
 
-public protocol ActiveRecord: AnyType, Transformable {
+public enum Action {
+    case Create
+    case Update
+    case Delete
+}
+
+public protocol ActiveRecord: class, AnyType, Transformable {
     var id: AnyType? {set get}
     init()
     init(attributes: [String:AnyType?])



extension ActiveRecord {
    public var errors: Errors { return self.validate() }
    public var isValid: Bool { return self.validate().isEmpty }
    
    public func validate() -> Errors {
        var errors = Errors(model: self)
        let validators = self.validators()
        for (attribute, value) in self.attributes {
            if let validator = validators[attribute] {
                validator.validate(self, attribute: attribute, value: value, errors: &errors)


extension ActiveRecord {
    public static var tableName: String {
        let reflect = _reflect(self)
        let projectPackageName = NSBundle.mainBundle() .objectForInfoDictionaryKey("CFBundleExecutable") as! String
        let components = reflect.summary.characters.split(".").map({ String($0) }).filter({ $0 != projectPackageName })
        if let first = components.first {
            if let last = components.last where components.count > 1 {
                return "\(first.lowercaseString)_\(last.lowercaseString.pluralizedString())"
            }
            return first.lowercaseString.pluralizedString()
        }
        return "active_records"
    }
    
    public static var resourceName: String {
