private SpecialOwnerDto MapToDto(
     SpecialOwnerWriteModel input, long?id = null, string createdBy = null, string modifiedBy = null) =>
 new SpecialOwnerDto
 {
     Id         = id,
     CreatedBy  = createdBy,
     ModifiedBy = modifiedBy,
     Name       = input.Name,
     Remark     = input.Remark
 };
        public IHttpActionResult Post(SpecialOwnerWriteModel model)
        {
            if (model == null)
            {
                return(BadRequest(Constants.MISSING_MESSAGE_BODY));
            }

            var  dto = MapToDto(model, createdBy: _shibbolethAttribs.GetUid());
            long id  = _repo.Insert(dto);

            // Refetch the data.
            dto = _repo.GetById(id);
            var readModel = MapToModel(dto);

            return(CreatedAtRoute("GetSpecialOwnerById", new { id = readModel.Id }, readModel));
        }
        public IHttpActionResult Put(long id, SpecialOwnerWriteModel model)
        {
            if (model == null)
            {
                return(BadRequest(Constants.MISSING_MESSAGE_BODY));
            }

            if (!_repo.Exists(id))
            {
                return(NotFound());
            }

            var dto = MapToDto(model, id, modifiedBy: _shibbolethAttribs.GetUid());

            _repo.Update(dto);

            // Refetch the data.
            dto = _repo.GetById(id);
            var readModel = MapToModel(dto);

            return(Ok(readModel));
        }