/**
   * Create and show a notification containing the conversations name where the new conversation
   * message was posted.
   */
  private void sendNewConversationMessageNotification(int groupId, int conversationId) {
    Intent intent;
    boolean loggedIn = Util.getInstance(this).getLoggedInModerator() != null;
    if (loggedIn) {
      // User is logged in as local moderator.
      intent = new Intent(this, ModeratorMainActivity.class);
    } else {
      // User isn't logged in.
      intent = new Intent(this, GroupActivity.class);
    }
    intent.putExtra("groupId", groupId);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    // Create a PendingIntent containing the entire back stack.
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    if (loggedIn) {
      stackBuilder.addParentStack(ModeratorMainActivity.class);
    } else {
      stackBuilder.addParentStack(GroupActivity.class);
    }
    stackBuilder.addNextIntent(intent);
    PendingIntent pendingIntent =
        stackBuilder.getPendingIntent(groupId, PendingIntent.FLAG_UPDATE_CURRENT);

    // Set group icon as large icon.
    Conversation conversation =
        new GroupDatabaseManager(getApplicationContext()).getConversation(conversationId);
    Bitmap bitmap =
        BitmapFactory.decodeResource(
            getResources(),
            GroupController.getConversationIcon(conversation, getApplicationContext()));
    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder =
        new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_stat_notification_icon_1)
            .setColor(ContextCompat.getColor(this, R.color.uni_main_primary))
            .setLargeIcon(bitmap)
            .setContentTitle(
                String.format(
                    getString(R.string.push_message_conversation), conversation.getTitle()))
            .setAutoCancel(true)
            .setSound(defaultSoundUri)
            .setContentIntent(pendingIntent);

    if (conversation.getNumberOfUnreadConversationMessages() > 1) {
      notificationBuilder.setContentText(
          getString(R.string.push_message_new_conversation_messages));
      notificationBuilder.setNumber(conversation.getNumberOfUnreadConversationMessages());
    } else {
      notificationBuilder.setContentText(getString(R.string.push_message_new_conversation_message));
    }

    NotificationManager notificationManager =
        (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(5, notificationBuilder.build());
  }