Add a helper method for MARK command

* Move validity of displayedId to the new method (the old one actually does not work because NullPointerException is thrown as early as in isCompletedTask)