private static void UpdateRoomTypes(RoomForRentAnnouncement roomForRentAnnouncement, ICollection <RoomTypeEnumeration> roomTypes) { var roomTypesToRemove = roomForRentAnnouncement.RoomTypes.Except(roomTypes).ToList(); var roomTypesToAdd = roomTypes.Except(roomForRentAnnouncement.RoomTypes).ToList(); foreach (var roomType in roomTypesToRemove) { roomForRentAnnouncement.RemoveRoomType(roomType); } foreach (var roomType in roomTypesToAdd) { roomForRentAnnouncement.AddRoomType(roomType); } }