private static void ApplyStudentTransformation(IList <ResourceLoadOrder> resources)
        {
            var studentCreate = resources
                                .SingleOrDefault(r => r.Resource == "/ed-fi/students");

            if (studentCreate == null)
            {
                return;
            }


            var studentSchoolAssociation = resources
                                           .Single(r => r.Resource == "/ed-fi/studentSchoolAssociations");

            var studentUpdate = new ResourceLoadOrder()
            {
                Resource   = studentCreate.Resource,
                Order      = studentSchoolAssociation.Order + 1,
                Operations = new List <string> {
                    "Update"
                }
            };

            studentCreate.Operations.Remove("Update");

            resources.Insert(
                resources.IndexOf(resources.FirstOrDefault(r => r.Order == studentUpdate.Order) ?? resources[^ 1])
                , studentUpdate
                );
        }
        private static void ApplyStaffTransformation(IList <ResourceLoadOrder> resources)
        {
            // StaffEducationOrganizationEmploymentAssociation or StaffEducationOrganizationAssignmentAssociation
            //must be created before Staff can be updated.
            var staffCreate = resources
                              .SingleOrDefault(r => r.Resource == "/ed-fi/staffs");

            if (staffCreate == null)
            {
                return;
            }

            var staffEducationOrganizationEmploymentAssociation = resources
                                                                  .Single(r => r.Resource == "/ed-fi/staffEducationOrganizationEmploymentAssociations");

            var staffEducationOrganizationAssignmentAssociation = resources
                                                                  .Single(r => r.Resource == "/ed-fi/staffEducationOrganizationAssignmentAssociations");

            var highestOrder = Math.Max(
                staffEducationOrganizationAssignmentAssociation.Order, staffEducationOrganizationEmploymentAssociation.Order);

            var staffUpdate = new ResourceLoadOrder()
            {
                Resource   = staffCreate.Resource,
                Order      = highestOrder + 1,
                Operations = new List <string> {
                    "Update"
                }
            };

            staffCreate.Operations.Remove("Update");

            resources.Insert(
                resources.IndexOf(resources.FirstOrDefault(r => r.Order == staffUpdate.Order) ?? resources[^ 1])
                , staffUpdate
                );
        }
        private static void ApplyParentTransformation(IList <ResourceLoadOrder> resources)
        {
            // StudentParentAssociation must be created before Parents can be updated.
            // StudentSchoolAssociation must be created before Parents can be updated.
            // StudentSchoolAssociation must be created before ParentAssociations can be updated.
            var parentCreate = resources
                               .SingleOrDefault(r => r.Resource == "/ed-fi/parents");

            if (parentCreate == null)
            {
                return;
            }

            var studentParentAssociation = resources
                                           .Single(r => r.Resource == "/ed-fi/studentParentAssociations");

            var studentSchoolAssociation = resources
                                           .Single(r => r.Resource == "/ed-fi/studentSchoolAssociations");

            var higherOrder = Math.Max(studentParentAssociation.Order, studentSchoolAssociation.Order);

            var parentUpdate = new ResourceLoadOrder
            {
                Resource   = parentCreate.Resource,
                Order      = higherOrder + 1,
                Operations = new List <string> {
                    "Update"
                }
            };

            parentCreate.Operations.Remove("Update");

            resources.Insert(
                resources.IndexOf(resources.FirstOrDefault(r => r.Order == parentUpdate.Order) ?? resources[^ 1])
                , parentUpdate
                );
        }