public async Task <IdResult> UpdateRead(Models.Notification item)
        {
            if (item == null)
            {
                return(new IdResult()
                {
                    IsOk = false,
                    ErrorMessage = "No notification info"
                });
            }

            Common.Model.Notification itemDb = null;
            var dbUser = DbUser;

            using (NotificationRepository _notificationRepository = new NotificationRepository(Context, dbUser, null))
            {
                itemDb = _notificationRepository.GetById(item.Id);
                if (itemDb != null)
                {
                    try
                    {
                        _notificationRepository.Update(itemDb);
                        itemDb.ReadDate = DateTime.Now;
                        Context.SaveChanges();
                        return(new IdResult()
                        {
                            IsOk = true,
                            Id = itemDb.Id
                        });
                    }
                    catch (Exception e)
                    {
                        LogHelper.WriteError(e);
                        return(new IdResult()
                        {
                            IsOk = false,
                            ErrorMessage = "Error On Save"
                        });
                    }
                }
                return(new IdResult()
                {
                    IsOk = false,
                    ErrorMessage = "No notification info"
                });
            }
        }
        public async Task <IdResult> Submit(Models.Notification item)
        {
            if (item == null)
            {
                return(new IdResult()
                {
                    IsOk = false,
                    ErrorMessage = "No post info"
                });
            }

            Common.Model.Notification itemDb = null;
            var dbUser = DbUser;

            using (var transactionScope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
                using (NotificationRepository _notificationRepository = new NotificationRepository(Context, dbUser, null))
                {
                    {
                        try
                        {
                            if (item.Id == Guid.Empty)
                            {
                                //if (item.SelectedContact != null)
                                //{
                                //    var contactCircle = _userContactRepository.GetCircleByUsersPair(dbUser,
                                //        item.SelectedContact.Id);
                                //    if (contactCircle != null)
                                //    {
                                //        item.SelectedCircle = new Circle() { Id = contactCircle.Id };
                                //    }
                                //}

                                itemDb = new Common.Model.Notification()
                                {
                                };
                                _notificationRepository.Create(itemDb);
                            }
                            else
                            {
                                itemDb = _notificationRepository.GetById(item.Id);
                                _notificationRepository.Update(itemDb);
                            }

                            Context.SaveChanges();
                            if (itemDb != null)
                            {
                                transactionScope.Complete();
                                return(new IdResult()
                                {
                                    IsOk = true,
                                    Id = itemDb.Id
                                });
                            }
                            return(new IdResult()
                            {
                                IsOk = false,
                                ErrorMessage = "Error On Save"
                            });
                        }
                        catch (Exception e)
                        {
                            LogHelper.WriteError(e);
                            return(new IdResult()
                            {
                                IsOk = false,
                                ErrorMessage = e.ToString()
                            });
                        }
                    }
                }
        }