Inheritance: Bzs.Portable.DataTransferObjects.Base.ItemDtoBase
        /// <summary>
        /// Updates a teacher.
        /// </summary>
        /// <param name="itemToSave">The item to save.</param>
        /// <returns>The result.</returns>
        public ResultDto UpdateTeacher(TeacherEditDto itemToSave)
        {
            this.SetResponseHeaderCacheExpiration();

            AccountPassword credentials = this.GetCredentialsFromRequest();
            AccountServerService accountService = new AccountServerService();
            Guid accountId = accountService.GetAccountId(credentials.Account);

            TeacherServerService service = new TeacherServerService();
            return service.UpdateTeacher(itemToSave, accountId);
        }
        /// <summary>
        /// Inserts a teacher.
        /// </summary>
        /// <param name="itemToSave">The item to save.</param>
        /// <param name="accountId">The account identifier.</param>
        /// <returns>The result.</returns>
        public ResultDto InsertTeacher(TeacherEditDto itemToSave, Guid? accountId)
        {
            ResultDto result = new ResultDto();
            using (BzsEntityContainer ctx = this.CreateContainer())
            {
                TeacherEntity entity = ctx.TeacherSet.FirstOrDefault(f => f.Id == itemToSave.Id);
                if (entity != null)
                {
                    result.Error = "ERR-TEACHER-ALREADY-EXISTS";
                    return result;
                }

                entity = new TeacherEntity();
                entity.Id = itemToSave.Id;
                entity.AccountId = accountId;
                entity.Code = itemToSave.Code.Length > 10 ? itemToSave.Code.Substring(0, 9) : itemToSave.Code;
                entity.Caption = itemToSave.Caption.Length > 50 ? itemToSave.Caption.Substring(0, 49) : itemToSave.Caption;
                entity.ModDate = DateTime.Now;
                entity.ModUser = Environment.UserName;
                ctx.TeacherSet.Add(entity);

                ctx.SaveChanges();
                result.Success = true;
            }

            return result;
        }