@NotNull
  private Task createCase(final Element element, final XPath commentPath) {
    final String id = element.getAttributeValue("ixBug");
    final String title = element.getChildTextTrim("sTitle");
    final TaskType type = getType(element);
    return new Task() {

      @NotNull
      @Override
      public String getId() {
        return id;
      }

      @NotNull
      @Override
      public String getSummary() {
        return title;
      }

      @Nullable
      @Override
      public String getDescription() {
        return null;
      }

      @Override
      @SuppressWarnings("unchecked")
      public Comment @NotNull [] getComments() {
        List<Element> nodes;
        try {
          nodes = commentPath.selectNodes(element);
        }
        catch (Exception e) {
          throw new RuntimeException("Error selecting comment nodes", e);
        }
        List<Comment> comments = ContainerUtil.mapNotNull(nodes, new NotNullFunction<>() {
          @NotNull
          @Override
          public Comment fun(Element element) {
            return createComment(element);
          }

          private static Comment createComment(final Element element) {
            return new Comment() {
              @Override
              public String getText() {
                return element.getChildTextTrim("s");
              }

              @Nullable
              @Override
              public String getAuthor() {
                return element.getChildTextTrim("sPerson");
              }

              @Override
              public @NotNull Date getDate() {
                return parseDate(element.getChildTextTrim("dt"));
              }
            };
          }
        });
        return comments.toArray(Comment.EMPTY_ARRAY);
      }

      @NotNull
      @Override
      public Icon getIcon() {
        return TasksCoreIcons.Fogbugz;
      }

      @NotNull
      @Override
      public TaskType getType() {
        return type;
      }

      @Override
      public @NotNull Date getUpdated() {
        return parseDate(element.getChildText("dtLastUpdated"));
      }

      @Override
      public @NotNull Date getCreated() {
        return parseDate(element.getChildTextTrim("dtOpened"));
      }

      @Override
      public boolean isClosed() {
        return !Boolean.parseBoolean(element.getChildTextTrim("fOpen"));
      }

      @Override
      public boolean isIssue() {
        return true;
      }

      @Override
      public @NotNull String getIssueUrl() {
        return getUrl() + "/default.asp?" + getId();
      }

      @Override
      public @NotNull TaskRepository getRepository() {
        return FogBugzRepository.this;
      }
    };
  }
@NotNull
  private Task createCase(final Element element, final XPath commentPath)