The first ever democratically elected President of Egypt, Mohammed Morsi, has died after suffering a heart attack during his court proceedings.