The best solution would be for Azerbaijan to give Armenia the western most territory of Azerbaijan that is split away from the mainland.
Then Armenia can cede Nagorno-Karabakh to Azerbaijan.
Otherwise, let Russia mediate the crisis since they were the ones that created the confusing boundaries for those two countries.
But... but... but... Azerbaijan and Turkey wantsss the preciousssss! (rolls eyes)