  def update
    return unless access_granted?(params[:id])

    id = params[:article][:id] || params[:id]
    @article = Article.find(id)

    if params[:article][:draft]
      fetch_fresh_or_existing_draft_for_article
    else
      @article = Article.find(@article.parent_id) unless @article.parent_id.nil?
    end

    update_article_attributes

    if @article.draft
      @article.state = "draft"
    elsif @article.draft?
      @article.publish!
    end

    if @article.save
      Article.where(parent_id: @article.id).map(&:destroy) unless @article.draft
      flash[:success] = I18n.t("admin.content.update.success")
      redirect_to action: "index"
    else
      @article.keywords = Tag.collection_to_string @article.tags
      load_resources
      render "edit"
    end
  end