                         switch statusCode{
                         case 200..<299:
                             if let json = response.result.value {
-                                log.info(json)
-                                
-                                // TODO: map the json to array
-//                                completion()
+                                if let items = Mapper<Branch>().mapArray(json) {
+                                    for branch in items {
+                                        Alamofire.request(.GET, branch.latestCommitURLString!).responseJSON { res in
+                                            if let commitJSON = res.result.value {
+                                                if let commit = Mapper<Commit>().map(commitJSON) {
+                                                    self.branches.append((branch, commit))
+                                                }
+                                            }
+                                        }
+                                    }
+                                    completion()
+                                }
                             }
                         default:
                             if let errorHandler = errorHandler {

        self.repoName = repoName
    }
    
    
    func loadBranches(completion completion: ()->(), errorHandler: ((String) -> ())? = nil) {
        let url = "https://api.github.com/repos/\(ownerName)/\(repoName)/branches"
        Alamofire.request(.GET, url)
            .responseJSON { response in

import ObjectMapper

struct BranchListViewModel {
    
    var branches = [(Branch, Commit)]()
    
    var ownerName: String!
    var repoName: String!
