/// <summary>
        /// Update license date and time by user id.
        /// </summary>
        /// <param name="id">User id value.</param>
        /// <param name="newLicenseDate">New license date and time.</param>
        public void UpdateLicense(int id, DateTime newLicenseDate)
        {
            RegisteredUser updatingUser = _db.RegisteredUsers
                                          .FirstOrDefault(x => x.Id == id);

            if (updatingUser == null)
            {
                // TODO: Add logging
                return;
            }

            KeyHash  keyHash     = new KeyHash();
            DateTime currentDate = DateTime.Now;

            updatingUser.RegistrationDate  = currentDate;
            updatingUser.LicenseFinishDate = newLicenseDate;
            updatingUser.KeyHash           = keyHash.Decrypt(JsonConvert.SerializeObject(new UserJson
            {
                Name              = updatingUser.Name,
                MacAdress         = updatingUser.MacAdress,
                LicenseFinishDate = newLicenseDate,
                RegistrationDate  = currentDate
            }), "AssisTant321", "AlphaPeriod");

            _db.SaveChanges();
        }
        /// <summary>
        /// Add new user to database.
        /// </summary>
        /// <param name="registeredUser">Registered user object.</param>
        /// <returns>Result: true or false.</returns>
        public bool AddNewUser(RegisteredUser registeredUser)
        {
            try
            {
                KeyHash  keyHash     = new KeyHash();
                DateTime currentDate = DateTime.Now;

                registeredUser.RegistrationDate = currentDate;

                registeredUser.KeyHash = keyHash.Decrypt(JsonConvert.SerializeObject(new UserJson
                {
                    Name              = registeredUser.Name,
                    MacAdress         = registeredUser.MacAdress,
                    LicenseFinishDate = registeredUser.LicenseFinishDate,
                    RegistrationDate  = currentDate
                }), "AssisTant321", "AlphaPeriod");

                _db.RegisteredUsers.Add(registeredUser);
                _db.SaveChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }