/// <summary>
        /// Get slot assignments for a part. The returned array will have as many elements as there are crew
        /// slots for the part. If a slot has no assignment, it will be null.
        /// </summary>
        /// <param name="part"></param>
        /// <returns></returns>
        public static Assignment[] GetSlotAssignments(Part part)
        {
            Assignment[] slots = new Assignment[part.CrewCapacity];
            if (slots.Length == 0)
            {
                return(slots);
            }
            for (int index = 0; index < slots.Length; ++index)
            {
                slots[index] = null;
            }
            ModuleCrewAssignment module = ModuleCrewAssignment.Find(part);

            if (module != null)
            {
                Assignment        defaultAssignment = Assignment.Parse(module.defaultAssignment);
                List <Assignment> assignments       = ParseList(module.slotAssignments);
                for (int index = 0; index < slots.Length; ++index)
                {
                    Assignment slotAssignment = (index < assignments.Count) ? assignments[index] : null;
                    slots[index] = Append(slotAssignment, defaultAssignment);
                }
            }
            return(slots);
        }
        /// <summary>
        /// Ensure that all current assignments for the part will be persisted by making
        /// sure that there's a by-name ModuleCrewAssignment for every slot.
        /// </summary>
        public void PersistAssignments()
        {
            ModuleCrewAssignment module = ModuleCrewAssignment.Find(part);

            if (module == null)
            {
                return;
            }
            List <Assignment> assignments = new List <Assignment>(part.CrewCapacity);

            foreach (CrewSlot slot in Slots)
            {
                assignments.Add(Assignment.ForCrew(slot.Occupant));
            }
            module.slotAssignments = Assignment.ToString(assignments);
            Logging.Log("Persisted slot assignments for " + ToString() + ": " + module.slotAssignments);
        }