     }
     
     func create(request: Request) throws -> ResponseRepresentable {
+        let user = try requireAuth(req: request)
+        let metadata = try Metadata.all().first
+        
         let params = try Validator.validate(req: request, expected:
             [
                 K.API.Title : Type.String,

                              mediaDuration: params.string[K.API.MediaDuration] ?? "",
                              GUID: params.string[K.API.GUID] ?? "",
                              publishDate: params.string[K.API.PublishDate] ?? "",
                              createdBy: params.int[K.API.CreatedBy] ?? -1,
                              metadata: params.int[K.API.Metadata] ?? -1)
        
        try podcast.save()
        return podcast
    }
    
    func replace(request: Request, podcast: Podcast) throws -> ResponseRepresentable {
        try podcast.delete()
        return try create(request: request)
    }

            clear: clear
        )
    }
    
    private func requireAuth(req: Request) throws -> User {
        guard let user = try req.auth.user() as? User else {
            throw Abort.custom(status: Status.unauthorized, message: "Unauthorized")
        }
        return user
    }
    
}
