 
 import UIKit
 
-enum ServiceCalled: String
+enum ServiceType: String
 {
     case Instagram = "Instagram"
     case Flickr = "Flickr"

        photosCountLabel.text = ""
        collectionView.dataSource = self
        collectionView.delegate = self
        segmentedControl.setTitle(ServiceCalled.Instagram.rawValue, forSegmentAtIndex: 0)
        segmentedControl.setTitle(ServiceCalled.Flickr.rawValue, forSegmentAtIndex: 1)
        callService(.Instagram)
    }
    
    @IBAction func actions(sender: AnyObject)

            Loader.dismiss()
            if let response = response
            {
                self?.serviceCallSucceed(serviceType, response: response)
            }
            else
            {
                self?.serviceCallFailedWithError(nil)
            }
        }) { [weak self] (error) in
            Loader.dismiss()
            self?.serviceCallFailedWithError(error)
        }
    }
    
    private func serviceCallSucceedWithType(type: ServiceType, response: AnyObject)
    {
        collectionView.setContentOffset(CGPointZero, animated: true)
        searchTermLabel.text = "#\(self.searchTerm)"
        top.removeAll()
        mostRecent.removeAll()
        switch type {
        case .Instagram:
            let result = InstagramUtility.parseResponse(response)
            top.appendContentsOf(result.top.map{$0 as Photo})
