def create_study(self, request):
     if not request.title:
         raise endpoints.BadRequestException('The data: title are obligatory.')
     study = StudyHelper.create(request.title)
     if not study:
         raise endpoints.BadRequestException('It was not possible to create the study')
     return StudyListResponse(studies=[StudyApiHelper().to_message(study.get())])
 def update_study(self, request):
     study = Study.get_by_id(request.id)
     if not study:
         raise endpoints.NotFoundException(
           "The study ID: " + str(request.id) + " doesn't exist")
     if not request.title:
         raise endpoints.BadRequestException('The data: title, country are obligatory.')
     study = StudyHelper.update(study.key, request.title)
     if not study:
         raise endpoints.BadRequestException('It was not possible to create the study')
     return StudyListResponse(studies=[StudyApiHelper().to_message(study.get())])