def end_scheduled_maintenance(sched_maint, at_time)
        at_time = Time.at(at_time) unless at_time.is_a?(Time)

        if sched_maint.start_time >= at_time
          # the scheduled maintenance period is in the future
          self.scheduled_maintenances.remove(sched_maint)
          sched_maint.destroy
          return true
        elsif sched_maint.end_time >= at_time
          # it spans the current time, so we'll stop it at that point
          sched_maint.end_time = at_time
          sched_maint.save
          return true
        end

        false
      end
TODO allow summary to be changed as part of the termination