public API_Response <long> Update([FromBody] DTO_Intention model, [FromUri] string api_key = null)
 {
     return(InvokeAPI(() =>
     {
         model.ValidateData();
         //
         return _DL.Intention.Update.Intention(model.ViewModel);
     }, api_key));
 }
 public API_Response <long> Add([FromBody] DTO_Intention model, [FromUri] string api_key = null)
 {
     return(InvokeAPI(() =>
     {
         if (!Global.Cache.CheckTagExists(model.TagID))
         {
             throw new TagNotFoundException();
         }
         if (!Global.Cache.CheckUserExists(model.HolderUserID, model.IssuerUserID))
         {
             throw new UserNotFoundException();
         }
         // Validate Input data
         model.ValidateData(isNew: true);
         //
         var rez = _DL.Intention.Add.Intention(model.ViewModel);
         if (rez > 0 && _DL.Tag.Get.Role(model.TagID, model.IssuerUserID) == EN_TagRole.None)
         {
             _DL.Tag.Add.AddUser(model.TagID, (int)EN_TagRole.Member, model.IssuerUserID);
         }
         // Total Summ
         var tag = _DL.Tag.Get.ByID(model.TagID);
         decimal totalSum = _DL.Intention.Get.Intention_Sum_ByTagID(tag.TagID) + _DL.Obligation.Get.Obligation_Sum_ByTagID(tag.TagID);
         // If total amount bigger then tag amount
         if (totalSum >= tag.TotalAmount && tag.ApplicationType == EN_ApplicationType.Own_Initiative)
         {
             Dictionary <string, string> dic = new Dictionary <string, string>();
             EN_EventType type = EN_EventType.Own_Initiative_Tag_Reached_Target_Amount_Including_Intentions;
             // Add Keys
             dic.Add("TagID", tag.TagID.ToString());
             // Create new event
             new EventModel(dic, type);
         }
         //
         return rez;
     }, api_key));
 }