private List<Post> processPosts(List<Post> serverList) throws Exception {
    List<Post> totalList = new ArrayList<>(serverList.size());

    if (cached.size() > 0) {
      totalList.addAll(cached);

      // If there's a cached post but it's not in the list received from the server, mark it as
      // deleted
      if (loadable.isThreadMode()) {
        boolean serverHas;
        for (Post cache : cached) {
          serverHas = false;
          for (Post b : serverList) {
            if (b.no == cache.no) {
              serverHas = true;
              break;
            }
          }

          cache.deleted = !serverHas;
        }
      }

      // If there's a post in the list from the server, that's not in the cached list, add it.
      boolean known;
      for (Post post : serverList) {
        known = false;

        for (Post cache : cached) {
          if (cache.no == post.no) {
            known = true;
            break;
          }
        }

        // serverPost is not in finalList
        if (!known) {
          totalList.add(post);
        }
      }

      // Sort if it got out of order due to posts disappearing/reappearing
      /*if (loadable.isThreadMode()) {
          Collections.sort(totalList, new Comparator<Post>() {
              @Override
              public int compare(Post lhs, Post rhs) {
                  return lhs.time == rhs.time ? 0 : (lhs.time < rhs.time ? -1 : 1);
              }
          });
      }*/

    } else {
      totalList.addAll(serverList);
    }

    Set<Integer> invalidatedPosts = new HashSet<>();
    for (Post post : totalList) {
      if (!post.deleted) {
        post.repliesFrom.clear();

        for (Post other : totalList) {
          if (other.repliesTo.contains(post.no) && !other.deleted) {
            post.repliesFrom.add(other.no);
          }
        }
      } else {
        post.repliesTo.clear();

        for (int no : post.repliesFrom) {
          invalidatedPosts.add(no);
        }

        post.repliesFrom.clear();
      }
    }

    for (int no : invalidatedPosts) {
      for (Post post : totalList) {
        if (post.no == no) {
          if (!post.finish()) {
            throw new IOException("Incorrect data about post received.");
          }
          break;
        }
      }
    }

    for (Post post : totalList) {
      post.isSavedReply = ChanApplication.getDatabaseManager().isSavedReply(post.board, post.no);
    }

    return totalList;
  }