private Tuple <IotLinkType, int> UpdateIot(IotLink link) { IotLinkType iotLinkType; int replyId; if (link.Form == null) { iotLinkType = IotLinkType.Ideation; replyId = link.IdeationReply.IdeationReplyId; } else { iotLinkType = IotLinkType.Form; replyId = link.Form.FormId; } switch (iotLinkType) { case IotLinkType.Ideation: _ideationManager.UpdateReply(link.IdeationReply); break; case IotLinkType.Form: _formManager.UpdateForm(link.Form); break; } try { _unitOfWorkManager.FixUnchangedEntries(); // only used one time where 2 dbcontexts were unavoidable -> UI.MVC/scheduler _unitOfWorkManager.Save(); } catch (Exception e) { Console.WriteLine(e); } return(new Tuple <IotLinkType, int>(iotLinkType, replyId)); }