Solicitor Colm Dempsey , defending , said Kinghorn had a heroin problem and had been placed on a Drug Treatment and Testing Order at Edinburgh Sheriff Court four months before the bank deception took place .