Generalised algebraic theories and contextual categories