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: 20200326221616_regenerate_notifications.rb
    path of file: ./repos/open-build-service/src/api/db/data
    
    the code of the file until where you have to start completion: #  After some changes in Notification's database structure, some data needs to
#  be updated. But, instead of fixing the existing Notifications, we are going
#  to delete the affected ones and regenerate them with the correct values.
#
#  The deletion is made i
    
  def create_request_statechange_notifications
    declined_requests = BsRequest.in_states(:declined).where('created_at >= ?', 100.days.ago.midnight)

    declined_requests.each do |request|
      event = Event::RequestStatechange.new(request.event_parameters)
      event.payload['oldstate'] = request_old_state(request)
      NotificationService::Notifier.new(event).call
    end
  end