public Result <DataProcessingRegistrationOversightDate, OperationError> RemoveOversightDate(int oversightId)
        {
            if (!HasOversightDate(oversightId))
            {
                return(new OperationError("Oversight date not assigned", OperationFailure.BadInput));
            }

            var oversightDateToRemove = OversightDates.Where(x => x.Id == oversightId).First();

            OversightDates.Remove(oversightDateToRemove);

            return(oversightDateToRemove);
        }
        public Result <DataProcessingRegistrationOversightDate, OperationError> ModifyOversightDate(int oversightId, DateTime oversightDate, string oversightRemark)
        {
            if (oversightDate == null)
            {
                throw new ArgumentNullException(nameof(oversightDate));
            }
            if (oversightRemark == null)
            {
                throw new ArgumentNullException(nameof(oversightRemark));
            }
            if (!HasOversightDate(oversightId))
            {
                return(new OperationError("Oversight date not assigned", OperationFailure.BadInput));
            }

            var oversightDateToModify = OversightDates.Where(x => x.Id == oversightId).First();

            oversightDateToModify.OversightDate   = oversightDate;
            oversightDateToModify.OversightRemark = oversightRemark;

            return(oversightDateToModify);
        }
        public Result <DataProcessingRegistrationOversightDate, OperationError> AssignOversightDate(DateTime oversightDate, string oversightRemark)
        {
            if (oversightDate == null)
            {
                throw new ArgumentNullException(nameof(oversightDate));
            }
            if (oversightRemark == null)
            {
                throw new ArgumentNullException(nameof(oversightRemark));
            }

            var newOversightDate = new DataProcessingRegistrationOversightDate
            {
                OversightDate   = oversightDate,
                OversightRemark = oversightRemark,
                Parent          = this
            };

            OversightDates.Add(newOversightDate);

            return(newOversightDate);
        }
 private bool HasOversightDate(int oversightId)
 {
     return(OversightDates.Where(x => x.Id == oversightId).Any());
 }