Evocation Wizard’s Sculpt Spell Ability with spells that persist over time – under what conditions is protection maintained?

One of my current players has the first Wizard Evoker for whom I have GMed.

His PC’s Sculpt Spells ability was easy to interpret at lower levels, when his evocation spells, like thunderwave and fireball, were instantaneous.

As he advances, however, he may obtain spells that have longer durations, such as Storm Sphere, Wall of Ice, or Whirlwind. I am realizing that I do not know how to adjudicate Sculpt Spell with spells that persist, especially when the initial conditions of the Sculpt Spell ability no longer apply.

Sculpt Spells says:

Beginning at 2nd level, you can create pockets of relative safety within the effects of your evocation spells. When you cast an evocation spell that affects other creatures that you can see, you can choose a number of them equal to 1 + the spell’s level. The chosen creatures automatically succeed on their saving throws against the spell, and they take no damage if they would normally take half damage on a successful save.

Storm Sphere, for example, has a a duration of Concentration (up to 1 minute) and says in part:

Each creature in the sphere when it appears or that ends its turn there must succeed on a Strength saving throw or take 2d6 bludgeoning damage.

To use the Sculpt Spell ability, the Evoker must see the creatures he is designating as being protected at the time he casts the Storm Sphere, and they must be in the area of the sphere at the time he casts it. It is clear that designating the protected creatures happens "when you cast".

What is not clear to me is whether the protection is for just the first round ("when you cast") or is meant to persist and provide protection on subsequent rounds.

If the protection normally persists, can it be lost if the creatures no longer meet the conditions that were required for them to be designated as protected?

What would happen to a protected creature if it was to exit the area of the Sphere and later re-enter?

Does the Evoker need to maintain them in his sight to maintain their protection? If they were originally protected when the spell was cast, but later became invisible, would it end their protection if the Evoker could no longer see them?

It is possible that reviewers may mark this as asking multiple questions. To be clear, I see all of these as examples of one question – Under what conditions does the protection afforded by Sculpt Spell persist or not persist over time?

Does the disadvantage on saves from Shadow Sorcerer’s Hound of Ill Omen feature persist beyond the first turn?

Shadow Sorcerer’s Hound of Ill Omen feature’s text reads:

…Additionally, while the hound is within 5 feet of the target, the target has disadvantage on saving throws against any spell you cast. The hound disappears if it is reduced to 0 hit points, if its target is reduced to 0 hit points, or after 5 minutes.

I’m curious if against any spell you cast refers to the action of casting the spell, or the condition of having been a spell that you cast in any tense.

The difference being that a spell like Hold Person would only get disadvantage on the first saving throw with the first interpretation, but on all following saving throws with the second interpretation.

The only comparable feature that I know of is Heightened Spell, a Sorcerer metamagic, that reads:

When you cast a spell that forces a creature to make a saving throw to resist its effects, you can spend 3 sorcery points to give one target of the spell disadvantage on its first saving throw made against the spell.

This feature is clear in its intent, that only the initial saving throw against any spell is affected and given disadvantage.

The lack of clarification on Hound of Ill Omen makes me wary of which way to rule.

Do removed parts of a Druid’s Wild Shape form persist after said Druid exits Wild Shape?

A player wanted to use Wild Shape as an unlimited supply of feathers for our ranger to make his own arrows with and it sparked a discussion on whether or not parts of a Druid that are removed from said Druid’s Wild Shape persist after the Druid is no longer in Wild Shape.

I have been unable to find any rules that either allow or disallow this action. Whereas there are specific rules on what happens to gear the druid is wearing, I have found no statement on what happens to removed physical parts of the Wild Shape form.

I have thought of two reasonable solutions:

  1. Removed pieces of Wild Shape form persist indefinitely. This would make a Druid Indistinguishable from a normal creature until knocked out of druid form and would make the party assassin happy as he now has a reliable fresh supply of Giant venomous snake venom to apply to his daggers.

  2. Removed pieces of wild shape form persist until the Druid leaves Wild Shape. This would avoid the issues of unlimited resources, but raise other questions such as whether blood spilled by the Wild Shape also disappears or whether a creature that has “become poisoned for 1 hour” would stop being poisoned when the Druid is knocked out of that shape because the poison has dissipated with his Wild Shape.

Which (if either) of these lines up with the rules? Or does this fall under DM fiat?

Do the ideas that support the Suggestion spell persist after the end of the spell?

The Suggestion spell influences a creature by suggesting a course of action:

You suggest a course of activity (limited to a sentence or two) and magically influence a creature you can see within range that can hear and understand you. Creatures that can’t be charmed are immune to this effect. The suggestion must be worded in such a manner as to make the course of action sound reasonable. Asking the creature to stab itself, throw itself onto a spear, immolate itself, or do some other obviously harmful act ends the spell.

The target must make a Wisdom saving throw. On a failed save, it pursues the course of action you described to the best of its ability. The suggested course of action can continue for the entire duration. If the suggested activity can be completed in a shorter time, the spell ends when the subject finishes what it was asked to do.

You can also specify conditions that will trigger a special activity during the duration. For example, you might suggest that a knight give her warhorse to the first beggar she meets. If the condition isn’t met before the spell expires, the activity isn’t performed.

If you or any of your companions damage the target, the spell ends.

The description suggests the idea that this course of action sounds reasonable to the target, in such a way that it could be a decision that the target took on his own. Furthermore, contrary to other illusion spells (e.g. Friends), the target won’t notice that he has been charmed.

However, I am not sure whether the ideas suggested by the spell persist after the spell ends. Consider the following example:

A creature owns a magical item connected to evil forces. He is using that item for his purposes. Another creature casts Suggestion by saying: “You feel that this item is ruining your soul. You will get rid of it, and you will go praying for 2 hours in order to purify your soul.”

Supposing that the target considers it reasonable, and gets rid of the item. Then, for some reason, the spell ends. Now, how will the target react? Will he keep considering that idea reasonable, or will he try to get the item back?

Do the ideas that justify the Suggestion spell persist after the end of the spell?

How can we confidently say that stacking Reach Spell, Persistent Spell, and Ocular Spell lets you persist almost any spell?

I’ve recently been reading up on the finer details of The Twice-Betrayer of Shar and found that there exists an objection to whether or not it can Persist the spells that it claims to be able to. This has lead me to read further in to how the build’s tricks for persisting spells works.

As I understand it, the central premise of the build is that the correct permutations of Reach Spell, Persistent Spell, and Ocular Spell should let you persist “just about every spell on the books“. However, I’m unsure of how such a strong claim can be made. Reach Spell only works on touch spells, Persistent Spell only works on spells with “a fixed or personal range“, and Ocular Spell only works on “ray spells and spells with a target other than personal“. This game has so many of different descriptors for spells that I find it impossible to believe that these three metamagic feats are enough to let you persist almost anything.

So what have I missed? How can it confidently be said that this combination lets you persist almost anything, when there’s so many different types of spell in the game? Have I overlooked some qualifier?

How do I make scale of a GameObject persist in Unity?

I’m currently developing a Hololens application and I’ve used Microsoft’s official spatial anchor documentation to create a voice command that can persistently anchor a GameObject in place. So if I exit the application and start it again, the GameObject will be in the same position and orientation as I had left it. However, a problem is that it doesn’t save the scale of the object. So what I need to do is somehow save the scale of the GameObject at the time at which I last manipulated it, and then upon startup, retrieve this saved scale and apply it dynamically to my GameObject.

I know what I have to do, I just don’t know how to do it. Does anyone have any experience doing this and could tell me what to do?

Changes to SD card do not persist after unmounting

I have a couple of 128GB Samsung EVO+ micro SD cards. I have two different means of connecting these to my mid-2012 MacBook Pro running MacOS 10.13 High Sierra: a micro-to-fullsize SD adaptor, which I insert into the MBP’s card reader slot, and a Lexar microSD-to-USB adaptor, which I insert into a USB slot.

I can read from both cards without issue (save that the OS only seems to notice a card in the card reader slot about a quarter of the time). The exfat volumes on the cards mount and files on them can be accessed. Disk Utility shows “Writable: Yes” in the Info window for the mounted volume. mount shows that the volume is mounted properly, with no read-only flag indicated.

Yet, if I make changes to the volume, for example by entering

cd /Volumes/S7; mkdir tmp; echo 'testing' >> tmp/test; 

these changes appear to have been made successfully, but upon remounting the volume, neither the file nor the directory it was created in are anywhere to be found.

I have similar problems when using fdisk to change the partition type (my actual goal right now) so I can use the SD card (and its contents) in my Android phone: changes to the MBR partition table appear to be written successfully, but then are not apparent when the partition table is displayed immediately afterwards.

Other USB volumes (for example, an external hard drive) work correctly. I haven’t tried using any other SD cards yet.

These problems occur with both SD cards, whether connected via the fullsize adaptor or the USB adaptor.

I upgraded from 10.10 relatively recently and suspect that these problems have started since the upgrade. Are there any similar known issues with using SD cards under High Sierra or other MacOS versions?

Add radio buttons to search block and have selection persist

I’m relatively new to Drupal and have been working with 7 and 8.

I’m trying to modify the search block to add radio buttons – allowing users to select if they’re searching the site or a catalog.

With the site selected, Drupal searches like normal. With the catalog selected, the search query is passed to a separate URL and handled that way.

I have it working for the most part, however, the radio button resets to default after a search is executed or the page is changed. I want the user selection to persist.

I’ve tried using a custom submit handler to store the search preference in a session and use that to set the default value in mymodule_form_alter().

However, my function is never called when the search block form is submitted. I’ve gone through many posts about “submit handler not working” and have tried different variations. I can also see my function in the array when I print it to the page, but still nothing.

Any help would be appreciated.

/**  * Implements hook_form_alter().  */ function mymodule_search_form_alter(&$  form, FormStateInterface $  form_state, $  form_id) {      if ($  form_id == 'search_block_form' || $  form_id == 'search_form') {          $  form['#attached']['library'][] = 'mymodule_search/mymodule_search';     }      if ($  form_id == 'search_block_form') {          //the options to display in our form radio buttons         $  options = array(             0 => t('Site'),             1 => t('Catalog')         );          // Get search preference from session         $  session = \Drupal::request()->getSession();          $  search_pref = $  session->get('mymodule_search_preference');          $  default_search_pref = (empty($  search_pref) || !is_numeric($  search_pref)) ? 0 : $  search_pref;          // Add radio buttons         $  form['mymodule_search_preference'] = array(             '#type' => 'radios',             '#title' => '',             '#options' => $  options,             '#description' => '',             '#default_value' => $  default_search_pref         );          // Placeholder         $  placeholder_text = \Drupal::config('mymodule_search.settings')->get('placeholder_text');          $  form['keys']['#attributes']['placeholder'] = t('@placeholder', ['@placeholder' => $  placeholder_text]);          // Submit handler to set session         $  form['actions']['submit'][] = 'mymodule_search_custom_search_pref';      } }   /**  * Custom search pref  */ function mymodule_search_custom_search_pref(&$  form, FormStateInterface $  form_state){          $  search_pref = $  form_state->getValue('mymodule_search_preference');          $  session = \Drupal::request()->getSession();          $  session->set('mymodule_search_preference', $  search_pref);  } 

Persist payload containing multiple items using EF Core Performance Improvements

I have an .NET CORE EF application setup as Database first that is supposed to take in a payload containing items to be persisted to my database. They payloads can be huge all containing multiple “Securities” and each “Security” has multiple “Positions/Transactions” to be persisted to the database. Sometimes the time taken to persist can grow exponentially and some of the payloads can take up to 20 minutes to persist. The ultimate goal here is to reduce the amount of time taken to run through this code and persist. The save function is not the issue here (afaik). I think the issue is the nested looping through the securities on the payload and all of their positions and the corresponding LINQ queries that are happening in HandlePostions/HandleTransactions/TryFindSecId functions. Any help cleaning/speeding this up would be welcomed and any help optimizing the queries would be great. Here is my calling function:

    private async Task<AccPackBody> Persist(AccPackBody pack)     {         bool hasModifications = false, hasErrors = false;         var secGuidsWithPositions = new List<Guid>();          using (var dbContext = new newportMasterContext(Configs.MasterDbConnString))         {             dbContext.Database.SetCommandTimeout(300);              foreach(var mappedSecurity in pack.Internal)             {                 mappedSecurity.FirmId = pack.FirmId;                  SEC_IDENTIFIER existingSecurity = null;                 try                 {                          existingSecurity = await TryFindSecId(mappedSecurity, pack.FirmId.Value, dbContext);                  }                 catch(Exception ex)                 {                     await Logger.Send(LogType.Error, "Something failed while trying to clone security");                 }                  if(existingSecurity == null)                 {                     await Logger.Send(pack, LogType.Error, $  "Missing security for: Identifier: {mappedSecurity.IdentifierName} Value: {mappedSecurity.IdentifierValue}, Firm{pack.FirmId}, Currency:{mappedSecurity.Currency}");                     throw new LoggedException();                 }                 else                 {                     mappedSecurity.SecurityGuid = existingSecurity.Security_UID;                      POSITION[] updatedPositions = null;                     if(mappedSecurity.Postitions != null && mappedSecurity.Postitions.Length > 0)                     {                                updatedPositions = HandlePositions(pack,dbContext, pack.State, pack.AccountUID.Value, mappedSecurity, pack.StatementDate.Value);                          secGuidsWithPositions.Add(mappedSecurity.SecurityGuid.Value);                          mappedSecurity.Postitions = updatedPositions != null  && updatedPositions.Count() > 0                             ? updatedPositions                             : new POSITION[0];                          if(updatedPositions != null && updatedPositions.Count() > 0)                             hasModifications = true;                     }                      //EditTransaction                     TRANSACTION[] updatedTransactions = null;                     if(mappedSecurity.Transactions != null && mappedSecurity.Transactions.Length > 0)                     {                          mappedSecurity.Transactions = updatedTransactions != null && updatedTransactions.Count() > 0                             ? updatedTransactions                             : new TRANSACTION[0];                          if(updatedTransactions != null && updatedTransactions.Count() > 0)                             hasModifications = true;                     }                  }             }              if(!hasErrors && dbContext.ChangeTracker.HasChanges())             {                 try                 {                          await dbContext.SaveChangesAsync();                   }                 catch(Exception ex)                 {                     await Logger.Send(pack,LogType.Warning, "Error persisting changes to db, rolling back: " + ex.ToString());                     throw new LoggedException();                 }             }         }          return pack;     }  

Here are my three functions that the above method calls – these are where a lot of the slowdowns are occuring:

    private async Task<SEC_IDENTIFIER> TryFindSecId(AccMappedSecurity mappedSecurity, long firmId, newportMasterContext dbContext, Guid? packUid = null)     {          var existingSecurities = dbContext.SEC_IDENTIFIER             .Where(x => x.IdentifierName == mappedSecurity.IdentifierName                  && mappedSecurity.IdentifierValue == x.Identifier                 && x.FirmID == firmId                  && (string.IsNullOrEmpty(mappedSecurity.Currency) || x.SECURITY.Currency == mappedSecurity.Currency) && x.SECURITY.ChangeType != "D");          var existingSecurity = existingSecurities.FirstOrDefault();          if(existingSecurity == null)         {             var cloneResult = await ClonePostition.Clone(                 new ClonePositionRequest                 {                     IdentifierName = mappedSecurity.IdentifierName,                     IdentifierValue = mappedSecurity.IdentifierValue,                     NewCurrency = mappedSecurity.Currency,                     FirmId = firmId                 },                 Logger.LocalLog             );                if(cloneResult.Code != HttpStatusCode.InternalServerError)             {                 existingSecurity = dbContext.SEC_IDENTIFIER                 .FirstOrDefault(x => x.IdentifierName == mappedSecurity.IdentifierName                      && mappedSecurity.IdentifierValue == x.Identifier                     && x.FirmID == firmId                      && (string.IsNullOrEmpty(mappedSecurity.Currency) || x.SECURITY.Currency == mappedSecurity.Currency));               }             else             {                 await Logger.Send(LogType.Error, "Internal server error on clone function - clone failed" + cloneResult.Code);             }           }         else         {          }          return existingSecurity;     }          private POSITION[] HandlePositions(AccPackBody reqPayload, newportMasterContext dbContext, PackState state, Guid accountGuid, AccMappedSecurity mappedSecurity, DateTime statementDate, Guid? packUid = null)     {         if(useDiagnosticLogging) LocalLoggingUtilities.WriteDiagnosticLog(_logText, packUid.Value, "Hit handle positions");          var handledPositions = new List<POSITION>();         int posCnt = mappedSecurity.Postitions.Length;         if(useDiagnosticLogging) LocalLoggingUtilities.WriteDiagnosticLog(_logText, packUid.Value, "Deserializing mapped positions");         List<POSITION> deserializedPositions = mappedSecurity.Postitions             .Select(x => JsonConvert.DeserializeObject<POSITION>(x.ToString(), Configs.JsonCircularRefFixConfig))             .OrderBy(x => x.DateStart)             .ToList();          var updatedPosDetails = new List<POSITION_DETAIL>();         POSITION prevailingPosition = null;          if(useDiagnosticLogging) LocalLoggingUtilities.WriteDiagnosticLog(_logText, packUid.Value, "Checking for prevailing position.");          prevailingPosition = dbContext.POSITION             .Include(x => x.POSITION_DETAIL)             .Include(x => x.POSITION_DETAIL).ThenInclude(x => x.POSITION_BOND)             .Include(x => x.POSITION_DETAIL).ThenInclude(x => x.POSITION_FX)             .Include(x => x.POSITION_DETAIL).ThenInclude(x => x.POSITION_OPTION)             .Include(x => x.POSITION_DETAIL).ThenInclude(x => x.POSITION_PRICE)             .Where(x => x.Account_UID == accountGuid                  && x.Security_UID == mappedSecurity.SecurityGuid                  && x.SecurityFirmID == mappedSecurity.FirmId                  && (x.DateStart.Date <= statementDate) && (!x.DateEnd.HasValue || x.DateEnd.Value.Date < statementDate)                  && x.ChangeType != "D"                  && x.POSITION_DETAIL.Any(pd => pd.Genesis == "FEED" &&                                             pd.ChangeType != "D"))             .OrderByDescending(x => x.DateStart)             .ToList().FirstOrDefault();          if(useDiagnosticLogging) LocalLoggingUtilities.WriteDiagnosticLog(_logText, packUid.Value, "Looping incoming positions.");         foreach(var incomingPosition in deserializedPositions)         {             if(useDiagnosticLogging) LocalLoggingUtilities.WriteDiagnosticLog(_logText, packUid.Value, string.Format("Hit new incoming position:{0}", incomingPosition.Position_UID.ToString()));             incomingPosition.Account_UID = accountGuid;             incomingPosition.Security_UID = mappedSecurity.SecurityGuid.Value;             incomingPosition.SecurityFirmID = mappedSecurity.FirmId.Value;             incomingPosition.Position_UID = Guid.NewGuid();             if (prevailingPosition == null)             {                 EntityEntry<POSITION> newPosition = null;                 dbContext.POSITION.Add(incomingPosition);                 newPosition = dbContext.Entry(incomingPosition);                 newPosition.CurrentValues.SetValues(new { ChangeType = "I" });                 foreach(var posDetail in incomingPosition.POSITION_DETAIL.Where(x => x.ChangeType.ToUpper() != "D"))                 {                     EntityEntry<POSITION_DETAIL> newPositionDetail = null;                     posDetail.Detail_UID = Guid.NewGuid();                     dbContext.POSITION_DETAIL.Add(posDetail);                     newPositionDetail = dbContext.Entry(posDetail);                     newPositionDetail.CurrentValues.SetValues(new { ChangeType = "I"});                     updatedPosDetails.Add(posDetail);                 }                  handledPositions.Add(incomingPosition);                  if(useDiagnosticLogging) LocalLoggingUtilities.WriteDiagnosticLog(_logText, packUid.Value, "Inserted: " + incomingPosition.Position_UID.ToString());             }             else             {                 if(prevailingPosition.DateStart.Date == incomingPosition.DateStart.Date)                 {                     foreach(var posDetail in prevailingPosition.POSITION_DETAIL.Where(x => x.ChangeType.ToUpper() != "D"))                     {                         EntityEntry<POSITION_DETAIL> positionDetailToRemove = dbContext.Entry(posDetail);                         positionDetailToRemove.CurrentValues.SetValues(new                         {                             ChangeDate = DateTime.Now,                             ChangeType = "D"                         });                     }                     EntityEntry<POSITION> positionToRemove = dbContext.Entry(prevailingPosition);                     positionToRemove.CurrentValues.SetValues(new                      {                         ChangeDate = DateTime.Now,                         ChangeType = "D"                     });                      EntityEntry<POSITION> newPosition = null;                     dbContext.POSITION.Add(incomingPosition);                     newPosition = dbContext.Entry(incomingPosition);                     newPosition.CurrentValues.SetValues(new { ChangeType = "I" });                     handledPositions.Add(incomingPosition);                      if(useDiagnosticLogging) LocalLoggingUtilities.WriteDiagnosticLog(_logText, packUid.Value, "inserted: " + incomingPosition.Position_UID.ToString());                      foreach(var posDetail in incomingPosition.POSITION_DETAIL.Where(x => x.ChangeType.ToUpper() != "D"))                     {                         EntityEntry<POSITION_DETAIL> newPositionDetail = null;                         posDetail.Detail_UID = Guid.NewGuid();                         dbContext.POSITION_DETAIL.Add(posDetail);                         newPositionDetail = dbContext.Entry(posDetail);                         newPositionDetail.CurrentValues.SetValues(new { ChangeType = "I"});                         updatedPosDetails.Add(posDetail);                     }                 }                 else if(prevailingPosition.DateStart.Date < incomingPosition.DateStart.Date                      && PositionHasChange(prevailingPosition, incomingPosition, packUid))                 {                     EntityEntry<POSITION> newPosition = null;                     dbContext.POSITION.Add(incomingPosition);                     newPosition = dbContext.Entry(incomingPosition);                     newPosition.CurrentValues.SetValues(new { ChangeType = "I" });                     handledPositions.Add(incomingPosition);                      if(useDiagnosticLogging) LocalLoggingUtilities.WriteDiagnosticLog(_logText, packUid.Value, "inserted: " + incomingPosition.Position_UID.ToString());                      foreach(var posDetail in incomingPosition.POSITION_DETAIL.Where(x => x.ChangeType.ToUpper() != "D"))                     {                         EntityEntry<POSITION_DETAIL> newPositionDetail = null;                         posDetail.Detail_UID = Guid.NewGuid();                         dbContext.POSITION_DETAIL.Add(posDetail);                         newPositionDetail = dbContext.Entry(posDetail);                         newPositionDetail.CurrentValues.SetValues(new { ChangeType = "I"});                         updatedPosDetails.Add(posDetail);                     }                 }                 else if(prevailingPosition.DateStart.Date < incomingPosition.DateStart.Date                      && !PositionHasChange(prevailingPosition, incomingPosition, packUid))                 {                 }             }         }          return handledPositions.ToArray();     }       private TRANSACTION[] HandleTransctions(newportMasterContext dbContext, AccPackBody pack, AccMappedSecurity mappedSecurity, Guid? packUid = null)     {         object[] transactionsToProcess = new object[0];          var handledTransactions = new List<TRANSACTION>();          foreach(var trans in mappedSecurity.Transactions)         {             TRANSACTION handledTransaction = null,                  mappedTransaction = null;              mappedTransaction =  JsonConvert.DeserializeObject<TRANSACTION>(trans.ToString(), Configs.JsonCircularRefFixConfig);             mappedTransaction.Security_UID = mappedSecurity.SecurityGuid.Value;              //HACK             if(string.IsNullOrWhiteSpace(mappedTransaction.BaseCurrency))             {                 mappedTransaction.BaseCurrency = "USD";             }              //missing transId - drop out             if(mappedTransaction.Reversal && string.IsNullOrWhiteSpace(mappedTransaction.TranID))             {                 Logger.Send(pack, LogType.Warning, "Reversal Transaction is missing a transacation Id");                 throw new LoggedException();             }             else             {                 //if(mappedTransaction.Reversal && !string.IsNullOrWhiteSpace(mappedTransaction.TranID))                 if(mappedTransaction.Reversal)                 {                     List<TRANSACTION> transactionsInDb = dbContext.TRANSACTION                         .Where(x => x.Account_UID == pack.AccountUID                             && x.Security_UID == mappedSecurity.SecurityGuid                             && x.SecurityFirmID == mappedSecurity.FirmId                             && x.TradeDate.Date == mappedTransaction.TradeDate.Date                             && x.TranID == mappedTransaction.TranID                             && !x.Reversal                             && x.ChangeType != "D")                         .ToList();                      if(transactionsInDb.Count == 1)                     {                         mappedTransaction.Visible = false;                         TRANSACTION transactionInDb = transactionsInDb.FirstOrDefault();                         transactionInDb.Visible = false;                     }                 }                  mappedTransaction.SecurityFirmID = mappedSecurity.FirmId.Value;                 mappedTransaction.Account_UID = pack.AccountUID.Value;                  if(mappedTransaction?.Comment?.Length >= 100)                 {                     mappedTransaction.Comment = mappedTransaction.Comment.Substring(0,96) + "...";                 }                  mappedTransaction.Tran_UID = Guid.NewGuid();                  var comparer = new TransactionComparer();                 EntityEntry<TRANSACTION> transactionToInsert = null;                 dbContext.TRANSACTION.Add(mappedTransaction);                 transactionToInsert = dbContext.Entry(mappedTransaction);                 transactionToInsert.CurrentValues.SetValues(new { ChangeType = "I" });                  if(useDiagnosticLogging) LocalLoggingUtilities.WriteDiagnosticLog(_logText, packUid.Value, "inserted: " + mappedTransaction.Tran_UID.ToString());                  if(transactionToInsert != null)                 {                     transactionToInsert.CurrentValues.SetValues(new { ChangeDate = DateTime.Now });                 }                  handledTransaction = transactionToInsert?.Entity;                  if(handledTransaction != null)                 {                     handledTransactions.Add(handledTransaction);                 }              //   }             }            }          return handledTransactions.ToArray();     } 

Sample payload:

{   "id": "74a7c410-5b00-4268-bb40-73cf099160ff",   "custodianUid": "00000000-0000-0000-0000-000000000000",   "datasourceUid": "e4b30a37-d0bf-49d4-bee9-a0cc19959e6d",   "token": "@!!!@ec131ebc7537c0f8414447261af2a8ef28414815274ebd4ea0ba33caac231bc8",   "statementDate": "2019-01-07T00:00:00Z",   "accountUid": "0b251123-b9e5-4f59-be4d-4dde0f0eb23e",   "firmId": 490,   "state": 3,   "exceedsSizeLimit": false,   "external": [     {       "identifiervalue": "85280",       "identifierName": "AssetID",       "currency": "USD",       "firmId": null,       "batchid": null,       "securityGuid": null,       "previousPositionGuid": "57b63479-9cc1-49b3-9743-8932b1764d1e",       "previousPositionQty": 1000000,       "previousPositionStartDate": "2019-01-01T00:00:00+00:00",       "previousPositionEndDate": null,       "transactions": [],       "taxlots": [],       "positions": [         "1/7/2019 12:00:00 AM|TAA0315||@!!!@ec131ebc7537c0f8414447261af2a8ef28414815274ebd4ea0ba33caac231bc8|Security|Structured Product|85280|0|||||||||0.0000|0.0000||0|0|||0.00000|||1000000.00000|100.00|100.00|84.18000|84.18000|6/8/2021 12:00:00 AM|0.00||0.00|0.00|||841800.00|841800.00|USD|||||0.0000||||||||"       ],       "customs": []     },     {       "identifiervalue": "79428",       "identifierName": "AssetID",       "currency": "USD",       "firmId": null,       "batchid": null,       "securityGuid": null,       "previousPositionGuid": "238c6c1e-0815-4b74-8ac8-d695ddb5ff2e",       "previousPositionQty": 1500000,       "previousPositionStartDate": "2019-01-01T00:00:00+00:00",       "previousPositionEndDate": null,       "transactions": [],       "taxlots": [],       "positions": [         "1/7/2019 12:00:00 AM|TAA0315||@!!!@ec131ebc7537c0f8414447261af2a8ef28414815274ebd4ea0ba33caac231bc8|Security|Structured Product|79428|0|||||||||0.0000|0.0000||0|0|||0.00000|||1500000.00000|100.00|100.00|95.31000|95.31000|1/22/2021 12:00:00 AM|0.00||0.00|0.00|||1429650.00|1429650.00|USD|||||0.0000||||||||"       ],       "customs": []     }   ],   "internal": [     {       "_name": null,       "data": null,       "identifiervalue": "85280",       "identifierName": "AssetID",       "currency": "USD",       "previousPositionGuid": null,       "previousPositionQty": null,       "previousPositionStartDate": null,       "previousPositionEndDate": null,       "securityGuid": "c260432b-d169-474b-b142-83cd3e2b93e5",       "firmId": 490,       "positions": [         {           "Position_UID": "1e6b6a39-697a-468b-a266-bd5388475ec6",           "Account_UID": "0b251123-b9e5-4f59-be4d-4dde0f0eb23e",           "Security_UID": "c260432b-d169-474b-b142-83cd3e2b93e5",           "SecurityFirmID": 490,           "DateStart": "2019-01-07T00:00:00+00:00",           "DateEnd": null,           "ChangeDate": "2019-04-16T15:40:39.7454448Z",           "ChangeType": "I",           "BatchID": 2019416151243529,           "Account_U": null,           "Security": null,           "POSITION_DETAIL": [             {               "Detail_UID": "39048278-f993-4229-b596-c681315c46b1",               "Position_UID": "1e6b6a39-697a-468b-a266-bd5388475ec6",               "Type": "BASE",               "Quantity": 1000000,               "Currency": "USD",               "Value": 841800,               "LastPrice": 84.18,               "Cost": 100,               "AccruedInterest": 0,               "AccruedDividends": null,               "Expenses": null,               "UnrealizedGains": null,               "RealizedGains": null,               "Source_UID": "e4b30a37-d0bf-49d4-bee9-a0cc19959e6d",               "Genesis": "Feed",               "ChangeDate": "2019-04-16T15:40:39.8235573Z",               "ChangeType": "I",               "GenesisNavigation": null,               "TypeNavigation": null,               "POSITION_BOND": null,               "POSITION_FX": null,               "POSITION_OPTION": null,               "POSITION_PRICE": null             }           ],           "POSITION_IDENTIFIER": [],           "POSITION_SUBSCRIPTION": []         }       ],       "transactions": null,       "batchid": null     },     {       "_name": null,       "data": null,       "identifiervalue": "79428",       "identifierName": "AssetID",       "currency": "USD",       "previousPositionGuid": null,       "previousPositionQty": null,       "previousPositionStartDate": null,       "previousPositionEndDate": null,       "securityGuid": "266a3cc3-9f76-4ca1-a1bb-593c55d86e95",       "firmId": 490,       "positions": [         {           "Position_UID": "4d2e6c40-6878-4fab-96df-d62759e95917",           "Account_UID": "0b251123-b9e5-4f59-be4d-4dde0f0eb23e",           "Security_UID": "266a3cc3-9f76-4ca1-a1bb-593c55d86e95",           "SecurityFirmID": 490,           "DateStart": "2019-01-07T00:00:00+00:00",           "DateEnd": null,           "ChangeDate": "2019-04-16T15:40:39.870434Z",           "ChangeType": "I",           "BatchID": 2019416151243529,           "Account_U": null,           "Security": null,           "POSITION_DETAIL": [             {               "Detail_UID": "c894765d-482a-4649-87be-afc6c8092275",               "Position_UID": "4d2e6c40-6878-4fab-96df-d62759e95917",               "Type": "BASE",               "Quantity": 1500000,               "Currency": "USD",               "Value": 1429650,               "LastPrice": 95.31,               "Cost": 100,               "AccruedInterest": 0,               "AccruedDividends": null,               "Expenses": null,               "UnrealizedGains": null,               "RealizedGains": null,               "Source_UID": "e4b30a37-d0bf-49d4-bee9-a0cc19959e6d",               "Genesis": "Feed",               "ChangeDate": "2019-04-16T15:40:39.9798084Z",               "ChangeType": "I",               "GenesisNavigation": null,               "TypeNavigation": null,               "POSITION_BOND": null,               "POSITION_FX": null,               "POSITION_OPTION": null,               "POSITION_PRICE": null             }           ],           "POSITION_IDENTIFIER": [],           "POSITION_SUBSCRIPTION": []         }       ],       "transactions": null,       "batchid": null     }   ],   "batchid": 2019416151243529 }