You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: schedule_controller.rb
    path of file: ./repos/railsgoat/app/controllers
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
class ScheduleController < ApplicationController

  d
    
  def create
    message = false

      if params[:schedule][:event_type] == "pto"
        sched = Schedule.new(schedule_params)
        sched.date_begin, sched.date_end = format_schedule_date(params[:date_range1])
        sched.user_id = current_user.id
        a = sched.date_end
        if sched.save
          message = true
        end