@POST
  @Path("/feeds")
  @Consumes(MediaType.APPLICATION_JSON)
  public Response add(RssFeed rssFeed) {
    if (dao.getByLink(rssFeed.getLink()) == null) {
      dao.add(rssFeed);
      URI location = URI.create("/rss/feeds" + rssFeed.getId());
      return Response.created(location).build();

    } else {
      FeedInfo feedInfo = new FeedInfo();
      feedInfo.setInfo(rssFeed);

      System.err.println("Such feed is already in the DB");
      throw new DataBaseFeedException("Such feed is already in the DB", feedInfo);
    }
  }
  @POST
  @Path("/feeds/upload")
  @Consumes(MediaType.MULTIPART_FORM_DATA)
  public Response upload(@FormDataParam("file") InputStream file) {
    FeedParser parser = new FeedParser();
    List<RssFeed> feeds = parser.parseFeeds(file);

    if (feeds == null) throw new MultiPartQueryException("Unable to read sources from document.");

    feeds
        .stream()
        .forEach(
            feed -> {
              if (dao.getByLink(feed.getLink()) == null) {
                dao.add(feed);
              } else throw new DataBaseFeedException("Some feeds are already in the database.");
            });

    return Response.status(Response.Status.OK).build();
  }