/// <summary>
        /// Method to save a resident's shift details.
        /// Will perform intsert for new records and update existing.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel <ResidentShiftModel> Save(ResidentShiftModel model)
        {
            Func <ResidentShiftModel> resolver = () =>
            {
                var data = Mapper.Map(model);

                // NOTE: THIS SECTION CONTAINS CHANGES ADDED AFTER THE
                //    DEADLINE, TO RESOLVE BUG PERSISTING TIME ENTRIES
                if (data.Id > 0)
                {
                    var dataEntity = DhDataContext.ResidentShifts.FirstOrDefault(e => e.Id == data.Id);
                    dataEntity.StartDateTimeUtc           = data.StartDateTimeUtc;
                    dataEntity.EndDateTimeUtc             = data.EndDateTimeUtc;
                    DhDataContext.Entry(dataEntity).State = EntityState.Modified;
                }
                else
                {
                    DhDataContext.ResidentShifts.Add(data);
                }

                DhDataContext.SaveChanges();

                var affectedRecords = DhDataContext.SaveChanges();
                return(Mapper.Map(data));
            };

            return(Persist(resolver));
        }
        /// <summary>
        /// Method to remove a resident shift.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel Delete(ResidentShiftModel model)
        {
            Action resolver = () =>
            {
                var data = Mapper.Map(model);
                DhDataContext.ResidentShifts.Remove(data);
                DhDataContext.SaveChanges();
            };

            return(Persist(resolver));
        }