 class NewThreadViewModel {
     fileprivate var disposeBag = DisposeBag()
     func postNewThread(fid: Int, typeid: Int, title: String, content: String, completion: @escaping (NewTheadResult) -> Void = { _ in }) {
-        NetworkUtilities.formhash(from: "/forum/post.php?action=newthread&fid=\(fid)") { result in
+        NetworkUtilities.formhash(from: "/forum/post.php?action=newthread&fid=\(fid)") { [weak self] result in
+            guard let `self` = self else { return }
             switch result {
             case .success(let formhash):
                 HiPDAProvider.request(.newThread(fid: fid, typeid: typeid, title: title, content: content, formhash: formhash))

                    .subscribe { event in
                        switch event {
                        case .next(let html):
                            do {
                                let tid = try HtmlParser.tid(from: html)
                                completion(.success(tid))
                            } catch {
                                if let errorMessage = try? HtmlParser.newThreadErrorMessage(from: html) {
                                    completion(.failure(.unKnown(errorMessage)))
                                } else {
                                    completion(.failure(.unKnown(error.localizedDescription)))
                                }
                            }
                        case .error(let error):
                            completion(.failure(.unKnown(error.localizedDescription)))
                        default:

            }
        }
    }
    
    fileprivate func handleNewThreadResult(_ result: String, completion: @escaping (NewTheadResult) -> Void = { _ in }) {
        do {
            let tid = try HtmlParser.tid(from: result)
            completion(.success(tid))
        } catch {
            if let errorMessage = try? HtmlParser.newThreadErrorMessage(from: result) {
                completion(.failure(.unKnown(errorMessage)))
            } else {
                completion(.failure(.unKnown(error.localizedDescription)))
            }
        }
    }
}
