def batch_create
      params[:batch]&.to_unsafe_h&.each do |batch_resource, objects|
        batch_resource = batch_resource.to_s
        batch_module = batch_resource.underscore.singularize.to_sym
        resource = batch_resource.classify.constantize
        authorize_for(action: :create,
                      resource: batch_module)
        objects.each do |batch_object|
          authorize_for(action: :create,
                        resource: batch_module,
                        object: resource.new(batch_object))
        end
        resource.create!(objects)
      end
      head :created if params[:batch].present?
    end
def batch_create
      params[:batch]&.to_unsafe_h&.each do |batch_resource, objects|
        batch_resource = batch_resource.to_s
        batch_module = batch_resource.underscore.singularize.to_sym
        resource = batch_resource.classify.constantize
        authorize_for(action: :create,
                      resource: batch_module)
        objects.each do |batch_object|
          authorize_for(action: :create,
                        resource: batch_module,
                        object: resource.new(batch_object))
        end
        resource.create!(objects)
      end
      head :created if params[:batch].present?
    end
POST /batch_create
 This action creates records based on request payload. It reads the JSON
 taking it's keys as model scope and array values as records to create.