     event.end.setHours(data.to_time.split(':')[0])
     event.end.setMinutes(data.to_time.split(':')[1])
     event.recurring = data.recurring
+    event.id = data.id if data.id
     event
 
   displayErros: (errors)->

          dataType: 'json'

          success: (data)->
            $('#template_form').html('')
            $('#template_form').html('<p class="success">Saved Successfully</p>')
            event = FormHandler.setEvent event, data
            if event.id # refresh events if update
              templateSlotCalendar.fullCalendar 'rerenderEvents' 
            else
              templateSlotCalendar.fullCalendar "renderEvent",
                title: data.id.toString()
                start: event.start
                recurring: data.recurring
                end: event.end
                allDay: false
              , true # make the event "stick"
            $('#template_form').css('display', 'block')
          error: (xhr, textStatus, errorThrown) ->
            FormHandler.displayErros xhr.responseJSON.errors


    selectHelper: true

    select: (start, end, allDay) ->
      FormHandler.showForm( {start: start, end: end, isNew: true} )
      
    editable: true

