 
 import Foundation
 import CascadingTableDelegate
-fileprivate func < <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
-  switch (lhs, rhs) {
-  case let (l?, r?):
-    return l < r
-  case (nil, _?):
-    return true
-  default:
-    return false
-  }
-}
-
-fileprivate func > <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
-  switch (lhs, rhs) {
-  case let (l?, r?):
-    return l > r
-  default:
-    return rhs < lhs
-  }
-}
-
-
-protocol DestinationReviewUserSectionViewModel: class {
-	
-	var rowViewModels: [DestinationReviewUserRowViewModel] { get }
-	
-	var remainingRowViewModels: Int { get }
-	
-	/// Executed when user-related review data is changed in this instance.
-	var reviewUserDataChanged: ((Void) -> Void)? { get set }
-	
-	/// Retrieve more rows and add it to `rowViewModels`, then execute `onCompleted` when it's ready.
-	func retrieveMoreRowViewModels(_ onCompleted: ((Void) -> Void)?)
-}
 
 class DestinationReviewUserSectionDelegate: CascadingSectionTableDelegate {
 	
-	var viewModel: DestinationReviewUserSectionViewModel? {
-		didSet {
-			configureViewModelObserver()
-			updateChildDelegates()
-		}
-	}
+	fileprivate var viewModel: DestinationReviewSectionViewModel?
 	
 	fileprivate var footerView: ReviewSectionFooterView
 	
-	convenience init(viewModel: DestinationReviewUserSectionViewModel) {
+	convenience init(viewModel: DestinationReviewSectionViewModel) {
 		
 		self.init()
 		
+		viewModel.add(observer: self)
 		self.viewModel = viewModel
+		updateChildDelegates()
+		
 		self.reloadModeOnChildDelegatesChanged = .section(animation: .automatic)
-		
-		configureViewModelObserver()
-		updateChildDelegates()
 	}
 	
 	required init(index: Int = 0, childDelegates: [CascadingTableDelegate] = []) {

		super.init(index: index, childDelegates: childDelegates)				
		
		configureFooterViewObserver()
	}
	
	override func prepare(tableView: UITableView) {

		})
	}
	
}

extension DestinationReviewUserSectionDelegate: DestinationReviewSectionViewModelObserver {
	
	func reviewSectionDataChanged() {
		updateChildDelegates()
	}
}

extension DestinationReviewUserSectionDelegate {
