Cohen–Macaulay and Gorenstein Properties under the Amalgamated Construction