Changed toJson method to work with Gson lib which is more convenient