 private let kGuestsKey = "guests"
 private let kAlbumsKey = "albums"
 
-public let kDateFormatString = "yyyy-MM-dd 'at' HH:mm"
 class Event : BackendObject {
+    static let sDateFormatter = NSDateFormatter()
+
     override init() {
         super.init(className: kClassName)
+        
         // TODO - support more than one album
         let album = Album()
         album.saveEventually(nil)

        get { return self[kPinKey] as? String ?? nil }
    }
    
    var startDateTime : String? {
        set { setValue(startDateTime, forKey: kStartDateTimeKey) }
        get { return self[kStartDateTimeKey] as? String ?? nil }
    }
    
    var endDateTime : String? {
        set { setValue(endDateTime, forKey: kEndDateTimeKey) }
        get { return self[kEndDateTimeKey] as? String ?? nil }
    }
    
    var latitude : Double? {

        get { return self[kAlbumsKey] as? [Album] ?? [] }
    }
    
    var isLive : Bool {
        let now = NSDate()
        let afterStart = startDateTime.compare(now) == NSComparisonResult.OrderedAscending
        let beforeEnd = now.compare(endDateTime) == NSComparisonResult.OrderedAscending
        return afterStart && beforeEnd
    }

    
    func getAllPhotosInEvent(orderedBy: String?) -> [ThumbnailPhoto] {
        var photos : [ThumbnailPhoto] = []
        for album in self.albums {
            album.fetchIfNeeded()
            for p in album.photos {
                photos.append(p)
            }
        }
        
        let order = orderedBy ?? ""
        switch order {
        case "Date Descending":
            return photos // TODO - order by date
        default:
            return photos
        }
    }
}