public IActionResult AddNew([FromBody] Record record) { try { // save _recordService.AddNew(record); int entryTypeId = _categoryService.GetById(record.CategoryId).EntryTypeId; bool isIncome = _entryTypeService.CheckIfIncome(entryTypeId); _accountService.ChangeAccountMoneyAmount(record.AccountId, record.MoneyAmount, isIncome); return(Ok()); } catch (AppException e) { // return error message if there was an exception return(BadRequest(new { message = e.Message })); } }