         switch mediaType {
 
         case .Text, .Location:
+
             createMessageWithMessageInfo(messageInfo, failureHandler: failureHandler, completion: { messageID in
 
                 dispatch_async(dispatch_get_main_queue()) {


        default:

            s3UploadFileOfKind(.Message, withFileExtension: mediaType.fileExtension!, inFilePath: filePath, orFileData: fileData, mimeType: mediaType.fileExtension!.mimeType, failureHandler: failureHandler, completion: { s3UploadParams in

                switch mediaType {


    let fileExtension: FileExtension

    let metaDataString: String?
}

func tryUploadAttachment(uploadAttachment: UploadAttachment, failureHandler: ((Reason, String?) -> Void)?, completion: String -> Void) {

    guard let token = YepUserDefaults.v1AccessToken.value else {
        println("uploadAttachment no token")
        return
    }

    let headers: [String: String] = [
        "Authorization": "Token token=\"\(token)\"",
    ]

    var parameters: [String: String] = [
        "attachable_type": uploadAttachment.type.rawValue,
    ]

    if let metaDataString = uploadAttachment.metaDataString {
        parameters["metadata"] = metaDataString
    }

    let name = "file"
    let filename = "file.\(uploadAttachment.fileExtension.rawValue)"
    let mimeType = uploadAttachment.fileExtension.mimeType

    Alamofire.upload(.POST, yepBaseURL.absoluteString + "/api/v1/attachments", headers: headers, multipartFormData: { multipartFormData in

        for parameter in parameters {
            multipartFormData.appendBodyPart(data: parameter.1.dataUsingEncoding(NSUTF8StringEncoding)!, name: parameter.0)
        }

        switch uploadAttachment.source {

