function getNextCustomChartsAndReleased(prevCharts, newChartsToInject) {
  const newIds = newChartsToInject.map((c) => c.metadata.id)
  const releasedCustomCharts = []
  const nextCustomCharts = prevCharts
    .filter((prevChart) => {
      const shouldBeReleased = newIds.includes(prevChart.metadata.id)
      if (shouldBeReleased) {
        releasedCustomCharts.push(prevChart)
      }
      return !shouldBeReleased
    })
    .concat(newChartsToInject)
  return [nextCustomCharts, releasedCustomCharts]
}
@param {CustomChartContract[]} prevCharts
@param {CustomChartContract[]} newChartsToInject
@returns {[CustomChartContract[],CustomChartContract[]]}